| Line 11... |
Line 11... |
| 11 |
import org.slf4j.Logger;
|
11 |
import org.slf4j.Logger;
|
| 12 |
import org.slf4j.LoggerFactory;
|
12 |
import org.slf4j.LoggerFactory;
|
| 13 |
|
13 |
|
| 14 |
import in.shop2020.payment.service.handler.PaymentServiceHandler;
|
14 |
import in.shop2020.payment.service.handler.PaymentServiceHandler;
|
| 15 |
import in.shop2020.payments.PaymentService.Processor;
|
15 |
import in.shop2020.payments.PaymentService.Processor;
|
| - |
|
16 |
import in.shop2020.thrift.clients.config.ConfigClient;
|
| - |
|
17 |
import in.shop2020.utils.ConfigClientKeys;
|
| 16 |
|
18 |
|
| 17 |
public class PaymentServer {
|
19 |
public class PaymentServer {
|
| 18 |
private static Logger logger = LoggerFactory.getLogger(PaymentServer.class);
|
20 |
private static Logger logger = LoggerFactory.getLogger(PaymentServer.class);
|
| 19 |
|
21 |
|
| 20 |
private static PaymentServiceHandler handler;
|
22 |
private static PaymentServiceHandler handler;
|
| Line 24... |
Line 26... |
| 24 |
public static void main(String[] args){
|
26 |
public static void main(String[] args){
|
| 25 |
try{
|
27 |
try{
|
| 26 |
handler = new PaymentServiceHandler();
|
28 |
handler = new PaymentServiceHandler();
|
| 27 |
processor = new Processor(handler);
|
29 |
processor = new Processor(handler);
|
| 28 |
|
30 |
|
| - |
|
31 |
int port = 9012;
|
| - |
|
32 |
try {
|
| - |
|
33 |
String portNo = ConfigClient.getClient().get(ConfigClientKeys.payments_service_server_port.toString());
|
| - |
|
34 |
port = Integer.parseInt(portNo);
|
| - |
|
35 |
}catch(Exception e){
|
| - |
|
36 |
logger.warn("Unable to get port number from the Config server because of:", e);
|
| - |
|
37 |
}
|
| - |
|
38 |
|
| 29 |
TServerTransport serverTransport = new TServerSocket(9012);
|
39 |
TServerTransport serverTransport = new TServerSocket(port);
|
| 30 |
TTransportFactory tFactory = new TFramedTransport.Factory();
|
40 |
TTransportFactory tFactory = new TFramedTransport.Factory();
|
| 31 |
TProtocolFactory pFactory = new TBinaryProtocol.Factory();
|
41 |
TProtocolFactory pFactory = new TBinaryProtocol.Factory();
|
| 32 |
TServer server = new TThreadPoolServer(processor, serverTransport, tFactory, pFactory);
|
42 |
TServer server = new TThreadPoolServer(processor, serverTransport, tFactory, pFactory);
|
| 33 |
|
43 |
|
| 34 |
logger.info("Payment service started on port 9012");
|
44 |
logger.info("Payment service started on port 9012");
|