Subversion Repositories SmartDukaan

Rev

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

Rev 100 Rev 122
Line 2... Line 2...
2
Created on 25-Mar-2010
2
Created on 25-Mar-2010
3
 
3
 
4
@author: ashish
4
@author: ashish
5
'''
5
'''
6
from shop2020.config.client.ConfigClient import ConfigClient
6
from shop2020.config.client.ConfigClient import ConfigClient
7
from shop2020.model.v1.catalog.impl.CatalogServiceHandler import CatalogServiceHandler
-
 
8
from shop2020.thriftpy.model.v1.catalog import CatalogService
7
from shop2020.thriftpy.model.v1.catalog import  InventoryService
9
from thrift.transport import TSocket, TTransport
8
from thrift.transport import TSocket, TTransport
10
from thrift.protocol.TBinaryProtocol import TBinaryProtocolFactory
9
from thrift.protocol.TBinaryProtocol import TBinaryProtocolFactory
11
from thrift.server import TServer
10
from thrift.server import TServer
-
 
11
from shop2020.model.v1.catalog.impl.InventoryServiceHandler import InventoryServiceHandler
12
 
12
 
13
 
13
 
14
host_name = 'localhost'
14
host_name = 'localhost'
15
port = '9001'
15
port = '9001'
16
 
16
 
Line 23... Line 23...
23
    except:
23
    except:
24
        #error while spawning the config server
24
        #error while spawning the config server
25
        host_name = 'localhost'
25
        host_name = 'localhost'
26
        port = '9001'
26
        port = '9001'
27
    
27
    
28
    handler = CatalogServiceHandler()
28
    handler = InventoryServiceHandler()
29
    processor = CatalogService.Processor(handler)
29
    processor = InventoryService.Processor(handler)
30
    transport = TSocket.TServerSocket(port)
30
    transport = TSocket.TServerSocket(port)
31
    tfactory = TTransport.TFramedTransportFactory()
31
    tfactory = TTransport.TFramedTransportFactory()
32
    pfactory = TBinaryProtocolFactory()
32
    pfactory = TBinaryProtocolFactory()
33
    server = TServer.TThreadedServer(processor, transport, tfactory, pfactory)
33
    server = TServer.TThreadedServer(processor, transport, tfactory, pfactory)
34
    print "Starting CatalogService at, port "+ str(port)+" host "+host_name
34
    print "Starting InventoryService at, port "+ str(port)+" host "+host_name
35
    server.serve()
35
    server.serve()
36
    print "Server functioning"
36
    print "Server functioning"
37
    
37
    
38
 
38
 
39
if __name__ == '__main__':
39
if __name__ == '__main__':