| David Reiss | 9f3296b | 2010-08-31 16:58:41 +0000 | [diff] [blame] | 1 | This directory contains some glue code to allow Thrift RPCs to be sent over | 
 | 2 | ZeroMQ.  Included are client and server implementations for Python and C++, | 
 | 3 | along with a simple demo interface (with a working client and server for | 
 | 4 | each language). | 
 | 5 |  | 
 | 6 | Thrift was designed for stream-based interfaces like TCP, but ZeroMQ is | 
 | 7 | message-based, so there is a small impedance mismatch.  Most of issues are | 
 | 8 | hidden from developers, but one cannot be: oneway methods have to be handled | 
 | 9 | differently from normal ones.  ZeroMQ requires the messaging pattern to be | 
 | 10 | declared at socket creation time, so an application cannot decide on a | 
 | 11 | message-by-message basis whether to send a reply.  Therefore, this | 
 | 12 | implementation makes it the client's responsibility to ensure that ZMQ_REQ | 
 | 13 | sockets are used for normal methods and ZMQ_DOWNSTREAM sockets are used for | 
 | 14 | oneway methods.  In addition, services that expose both types of methods | 
 | 15 | have to expose two servers (on two ports), but the TZmqMultiServer makes it | 
 | 16 | easy to run the two together in the same thread. | 
 | 17 |  | 
 | 18 | This code was tested with ZeroMQ 2.0.7 and pyzmq afabbb5b9bd3. | 
 | 19 |  | 
 | 20 | To build, simply install Thrift and ZeroMQ, then run "make".  If you install | 
 | 21 | in a non-standard location, make sure to set THRIFT to the location of the | 
 | 22 | Thrift code generator on the make command line and PKG_CONFIG_PATH to a path | 
 | 23 | that includes the pkgconfig files for both Thrift and ZeroMQ.  The test | 
 | 24 | servers take no arguments.  Run the test clients with no arguments to | 
 | 25 | retrieve the stored value or with an integer argument to increment it by | 
 | 26 | that amount. | 
 | 27 |  | 
 | 28 | This code is not quite what I would consider production-ready.  It doesn't | 
 | 29 | support all of the normal hooks into Thrift, and its performance is | 
 | 30 | sub-optimal because it does some unnecessary copying. |