If you want to build you own SOA using Apache Thrift framework on Python you can use ThriftPool. It should act as container for all implemented services, e.g. spawn them, process request and handle exceptions in them. Services are simple python classes that implements generated by Thrift stubs, for example:
from thriftpool import BaseHandler
from org.stubs.users.Users import Iface, Processor
from org.stubs.users.ttypes import Profile
class UsersService(BaseHandler, Iface):
class options:
name = 'Users'
processor = Processor
def get_profile(id):
# do something useful here
return Profile()
That’s all, handler is ready.
Assume that we has an active virtualenv with installed thriftpool. To start daemon you should type in console:
$ thriftpoold