thrift-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Denis Samoilov <samoi...@gmail.com>
Subject Re: thrift c++ client and recovering connection
Date Sat, 19 Jul 2014 09:57:36 GMT
thank you! this is what I do now but decided to check that i do not miss simpler way.
On July 18, 2014 at 9:59:23 AM, Nevo Hed (nhed+thriftusr@aereo.com) wrote:

Hi Denis 

I don't know whats the "right" way, but I know that I recreate the whole 
stack on a reconnection 

i.e.: 
sock = boost::shared_ptr<TSocket> socket(new TSocket(..., ...)); 
trans = boost::shared_ptr<TTransport>(new TFramedTransport(sock)); 
boost::shared_ptr<TProtocol> protocol(new TBinaryProtocol(trans)); 
client = boost::shared_ptr<MyClient>(new MyClient(protocol)); 
trans->open(); 



On Thu, Jul 17, 2014 at 7:01 PM, Denis Samoilov <samoilov@gmail.com> wrote: 

> hi community, 
> 
> currently i use per call connection but due increase of communication 
> thinking to move to the model with always open connection. In this case I 
> need to handle situation when connection is lost and reopen it. 
> 
> What is right way to do this? Do I need to recreate client after connection 
> lost? Because simply transport->open() does not work. Also, what would be 
> correct exception to catch (currently i think to reconnect on any 
> exception)? 
> 
> Thank you! 
> 

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message