As far as I can tell, there is no built-in way to get Apache Thrift to interact with Boost.Asio or any other loop of external events.
/ Thrift Asio. Apache Thrift JIRA ( ), :
THRIFT-579: ASIO / ++
, -, / Asio.
, , TAsioServer boost::asio::io_service.
int main(int argc, char **argv) {
boost::asio::io_service io_service;
boost::shared_ptr<protocol::TProtocolFactory> protocolFactory(new protocol::TBinaryProtocolFactory());
boost::shared_ptr<CalculatorAsyncHandler> handler(new CalculatorAsyncHandler(io_service));
boost::shared_ptr<TProcessor> processor(new CalculatorAsyncProcessor(handler));
boost::shared_ptr<apache::thrift::async::TAsioServer> server(
new apache::thrift::async::TAsioServer(
io_service,
9090,
protocolFactory,
protocolFactory,
processor));
server->start();
io_service.run();
return 0;
}
TAsioServer, , , boost::asio::serial_port boost::asio::deadline_timer boost::asio::io_service.