Search code examples
c++thriftthrift-protocol

For which purposes used seqid in Apache Thrift?


I am investigating how to work Apache Thrift library and found that any send/receive operation uses seqid variable. But it always set to zero and I didnt find any place where it change or use. Its very strange. Does everyone know for which purposes this variable present in thrift?


Solution

  • The seqid is used in some places. For example, the Node.js JavaScript implementation uses sequence ids to map call responses back to client callbacks. The implementation thus reserves the right to do what it needs to with seqids so user level code should treat them as opaque. Servers must return the seqid received with the call response. Thus the Apache Thrift client implementation decides how and if seqids are used and the server simple returns them unchanged. For example, a Python client might send seqid 0 every call and a JavaScript client might use an autoincrement, the server's job is to return whatever seqid it received back to the caller regardless.