thrift-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matthieu Imbert <>
Subject Re: Thrift Service question
Date Tue, 26 Jul 2011 15:55:50 GMT
On 07/26/2011 05:32 PM, Steve Angelovich wrote:
> All,
> Is there a technique or pattern to be able to associate some piece of
> state information in the server with a specific client connection?  How
> are others handling this problem?
> I've been able to structure almost all my services so no state on the
> server is required but I have one case where want to be able to
> associate some information with a specific client.
> Thanks,
> Steve


 From what I have understood, doing this is against thrift's design 
principles, which are that thrift services are stateless.

Even though i agree with this principle, i nevertheless had to do the 
same thing as you. In my case, the server code is in twisted python. 
Normally, one thrift handler is instanciated, which serves all 
connexions. I inherited a custom Thrift server protocol from 
TTwisted.ThriftServerProtocol in which i redefine the connectionMade 
method to instanciate a thrift handler *per connexion*.

All this is really twisted / thrift specific and is quite a hack but it 
works. I don't know if you can do it in other languages or even in 
regular python thrift. I can give you more details (or send you code 
example) if you need so.



View raw message