Subversion Repositories SmartDukaan

Rev

Rev 1946 | Rev 2885 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1946 chandransh 1
package in.shop2020.payment.service;
2
 
3
import org.apache.thrift.protocol.TBinaryProtocol;
4
import org.apache.thrift.protocol.TProtocolFactory;
5
import org.apache.thrift.server.TServer;
6
import org.apache.thrift.server.TThreadPoolServer;
7
import org.apache.thrift.transport.TFramedTransport;
8
import org.apache.thrift.transport.TServerSocket;
9
import org.apache.thrift.transport.TServerTransport;
10
import org.apache.thrift.transport.TTransportFactory;
1953 chandransh 11
import org.slf4j.Logger;
12
import org.slf4j.LoggerFactory;
1946 chandransh 13
 
14
import in.shop2020.payment.service.handler.PaymentServiceHandler;
15
import in.shop2020.payments.PaymentService.Processor;
16
 
17
public class PaymentServer {
1953 chandransh 18
	private static Logger logger = LoggerFactory.getLogger(PaymentServer.class);
19
 
1946 chandransh 20
	private static PaymentServiceHandler handler;
21
 
22
	private static Processor processor;
23
 
24
	public static void main(String[] args){
25
		try{
26
			handler = new PaymentServiceHandler();
27
			processor = new Processor(handler);
28
 
29
			TServerTransport serverTransport = new TServerSocket(9012);
30
			TTransportFactory tFactory = new TFramedTransport.Factory();
31
			TProtocolFactory pFactory = new TBinaryProtocol.Factory();
32
			TServer server = new TThreadPoolServer(processor, serverTransport, tFactory, pFactory);
33
 
1953 chandransh 34
			logger.info("Payment service started on port 9012");
1946 chandransh 35
			server.serve();
36
		}catch(Exception ex){
37
			ex.printStackTrace();
38
		}
39
	}
40
}