RTBKit
0.9
Open-source framework to create real-time ad bidding systems.
|
00001 // This autogenerated skeleton file illustrates how to build a server. 00002 // You should copy it to another filename to avoid overwriting it. 00003 00004 #include "ThriftFlumeEventServer.h" 00005 #include <protocol/TBinaryProtocol.h> 00006 #include <server/TSimpleServer.h> 00007 #include <transport/TServerSocket.h> 00008 #include <transport/TBufferTransports.h> 00009 00010 using namespace ::apache::thrift; 00011 using namespace ::apache::thrift::protocol; 00012 using namespace ::apache::thrift::transport; 00013 using namespace ::apache::thrift::server; 00014 00015 using boost::shared_ptr; 00016 00017 class ThriftFlumeEventServerHandler : virtual public ThriftFlumeEventServerIf { 00018 public: 00019 ThriftFlumeEventServerHandler() { 00020 // Your initialization goes here 00021 } 00022 00023 void append(const ThriftFlumeEvent& evt) { 00024 // Your implementation goes here 00025 printf("append\n"); 00026 } 00027 00028 void close() { 00029 // Your implementation goes here 00030 printf("close\n"); 00031 } 00032 00033 }; 00034 00035 int main(int argc, char **argv) { 00036 int port = 9090; 00037 shared_ptr<ThriftFlumeEventServerHandler> handler(new ThriftFlumeEventServerHandler()); 00038 shared_ptr<TProcessor> processor(new ThriftFlumeEventServerProcessor(handler)); 00039 shared_ptr<TServerTransport> serverTransport(new TServerSocket(port)); 00040 shared_ptr<TTransportFactory> transportFactory(new TBufferedTransportFactory()); 00041 shared_ptr<TProtocolFactory> protocolFactory(new TBinaryProtocolFactory()); 00042 00043 TSimpleServer server(processor, serverTransport, transportFactory, protocolFactory); 00044 server.serve(); 00045 return 0; 00046 } 00047