While I am looking for a general RPC solution, Thrift comes to my eyes. It is now an Apache project although developed at Facebook. Thrift is very similar to Google’s protocol buffer, which was open sourced and hosted on Google Code. For me, Thrift seems support more languages and deployed with a whole set of surrounding support, including thread manager and server/client stubs. More interestingly, Thrift supports exception, that is, exceptions thrown by remote methods can be caught by client code. (I do not remember that Google protocol buffer support this ….)
- Download Thrift from http://incubator.apache.org/thrift
- Unpack the .tar.gz file to create /tmp/thrift-0.2.0
- Configure, build and install
./configure --prefix=~/wyi/thrift-0.2.0 CXXFLAGS='-g -O2'
- Generate source code from tutorial.thrift
~wyi/thrift/bin/thrift -r --gen cpp tutorial
Note that the -r flag indicates generating also include files. The result source code will be placed into a sub-directory named gen-cpp.
- Compile example C++ server and client programs in tutorial/cpp
Note that you might want to change the Makefile to tell the lib and include directories where Thrift was installed.