Skip to content

Instantly share code, notes, and snippets.

@reiddraper
Created February 9, 2011 00:01
Show Gist options
  • Save reiddraper/817579 to your computer and use it in GitHub Desktop.
Save reiddraper/817579 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
from scribe import scribe
from thrift.transport import TSocket
from thrift.transport import TTransport
from thrift.protocol import TBinaryProtocol
from thrift.server import TServer
def Handler():
pass
def Log(messages):
#print len(messages)
for m in messages:
print m.message.strip()
#return scribe.Log_result(scribe.ResultCode.OK)
return scribe.ResultCode.OK
Handler.Log = Log
handler = Handler
processor = scribe.Processor(Handler)
transport = TSocket.TServerSocket(9091)
#tfactory = TTransport.TBufferedTransportFactory()
tfactory = TTransport.TFramedTransportFactory()
pfactory = TBinaryProtocol.TBinaryProtocolFactory()
#server = TServer.TSimpleServer(processor, transport, tfactory, pfactory)
server = TServer.TThreadedServer(processor, transport, tfactory, pfactory)
#server = TServer.TThreadPoolServer(processor, transport, tfactory, pfactory)
server.serve()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment