Rev 1267 | Blame | Compare with Previous | Last modification | View Log | RSS feed
'''Created on 26-Aug-2010@author: ashish'''from shop2020.config.client.ConfigClient import ConfigClientfrom thrift.transport import TSocket, TTransportfrom thrift.protocol.TBinaryProtocol import TBinaryProtocolFactoryfrom thrift.server import TServerfrom shop2020.payments.impl.PaymentsHandler import PaymentsHandlerfrom shop2020.thriftpy.payments import PaymentServicehost_name = 'localhost'port = 9012dbname = 'payment'def main():#get the config clienttry:config_client = ConfigClient()host_name = config_client.get_property('payments_service_server_host')port = config_client.get_property('payments_service_server_port')dbname = config_client.get_property('payments_service_dbname')except:#error while spawning the config serverhost_name = 'localhost'port = 9012dbname = 'payment'handler = PaymentsHandler(dbname)processor = PaymentService.Processor(handler)transport = TSocket.TServerSocket(port)tfactory = TTransport.TFramedTransportFactory()pfactory = TBinaryProtocolFactory()server = TServer.TThreadedServer(processor, transport, tfactory, pfactory)print "Starting PaymentsService at, port "+ str(port)+" host "+host_nameserver.serve()print "Server functioning"if __name__ == '__main__':main()