Subversion Repositories SmartDukaan

Rev

Rev 115 | Rev 1267 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 115 Rev 1249
Line 9... Line 9...
9
from thrift.protocol.TBinaryProtocol import TBinaryProtocolFactory
9
from thrift.protocol.TBinaryProtocol import TBinaryProtocolFactory
10
from thrift.server import TServer
10
from thrift.server import TServer
11
from shop2020.config.client.ConfigClient import ConfigClient
11
from shop2020.config.client.ConfigClient import ConfigClient
12
 
12
 
13
host_name = 'localhost'
13
host_name = 'localhost'
14
port = '9002'
14
port = 9002
-
 
15
dbname = 'transaction' 
15
 
16
 
16
def main():
17
def main():
17
    try:
18
    try:
18
        config_client = ConfigClient()
19
        config_client = ConfigClient()
19
        host_name = config_client.get_property('transaction_service_server_host')
20
        host_name = config_client.get_property('transaction_service_server_host')
20
        port = config_client.get_property('transaction_service_server_port')
21
        port = config_client.get_property('transaction_service_server_port')
21
    except:
22
    except:
22
        #error while spawning the config server
23
        #error while spawning the config server
23
        host_name = 'localhost'
24
        host_name = 'localhost'
24
        port = '9002'
25
        port = 9002
25
        
26
        
26
    handler = OrderServiceHandler()
27
    handler = OrderServiceHandler(dbname)
27
    processor = TransactionService.Processor(handler)
28
    processor = TransactionService.Processor(handler)
28
    transport = TSocket.TServerSocket(port)
29
    transport = TSocket.TServerSocket(port)
29
    tfactory = TTransport.TFramedTransportFactory()
30
    tfactory = TTransport.TFramedTransportFactory()
30
    pfactory = TBinaryProtocolFactory()
31
    pfactory = TBinaryProtocolFactory()
31
    server = TServer.TThreadedServer(processor, transport, tfactory, pfactory)
32
    server = TServer.TThreadedServer(processor, transport, tfactory, pfactory)