4

I searched on the internet but couldn't find anything useful. First, I was thinking to use Protocol Buffers but it doesn't provide built in feature to track multiple messages (where one message finish and second starts) or message self delimiting, but I read about this feature in Thrift white paper and it seems good to me. Now I am thinking to use Thrift instead of Protocol Buffers.

I am working on custom protocol for that I don't require RPC, could someone suggest if I can use Thrift without RPC (as its in the Protocol Buffers, one simply use the streams function) and some starting point as thrift documentation is a bit cumbersome.

Thanks!

JensG
  • 13,148
  • 4
  • 45
  • 55
User
  • 619
  • 1
  • 9
  • 24
  • Yes, It is possible. A similar answer is given [Here][1] [1]: http://stackoverflow.com/questions/12328896/thrift-is-it-possible-to-do-only-serialization-with-c-thrift-library – user3369727 Mar 24 '14 at 18:29

2 Answers2

2

Yes, It is possible. A similar answer is given Here. Apache thrift can be used without RPC you can simply use transport and protocol layers related libraries as they are defined in the documentation.

Community
  • 1
  • 1
2

Apache Thrift is indeed a RPC- and serialization framework. The serialization part is used as part of the RPC mechanism, but can be used standalone. For the various languages there are samples and/or supporting helper classes available. If this is not the case for your particular language, the necessary code pretty much boils down to this (pseudo code):

var data = InitializeMyDataStructure(...);

var trans = new TStreamTransport(...);
var prot = new TJSONProtocol(trans);

data.write(prot);

Both transport(s) and protocol are pluggable, so instead JSON and a stream you are free to use your own protocol, and (for example) a file transport. Or whatever else combination makes sense for your use case and is supported for your target language.

as thrift documentation is a bit cumbersome.

You are free to ask any question, be it here or in the mailing list. Furthermore, we have a nice tutorial and the Test server/client pairs are also good examples for typical use cases.

JensG
  • 13,148
  • 4
  • 45
  • 55