[rabbitmq-discuss] Heartbeat -> re-establish connection flow Question

Tim Watson tim at rabbitmq.com
Tue Oct 2 16:17:22 BST 2012


Hi,

On 28 Sep 2012, at 20:34, m.luchak at smartasking.com wrote:

> Hi All,
>  
> We are running rabbitmq on Android and continue to have serious problems with maintaining a 3G tcp consumer connection.  We have implemented heartbeats but I am struggling to understand the flow to monitor and re-establish connections.  If I understand correctly:
>  
> Enabling heartbeats WITHOUT handling ShutdownSignalException would actually be counter productive as a number of missed heartbeats would close the connection.
>  
>  
> Is the "right way to do it" :
>  
> Enable heartbeats on the server
>  
> Setting (in Java) factory.setRequestedHeartbeat(HEARTBEAT_TIMEOUT);  will "auto-magically" enable      heartbeats on the client and no other call is neccessary to send heartbeats <- (big doubt here)
>  
> 

Yes, this is enough to set up heartbeats. The connection factory passes the heartbeat settings to the underlying connection, which in turn configures heartbeats. These are enabled on the client *and* the server, so that both ends can know about the other one going away unexpectedly. 

> Handle ShutdownSignalException cause and reconnect if it was a hard close..
>  
> 
> Does that sound about right?

Yep, that should do what you're after.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20121002/5db7e6b6/attachment.htm>


More information about the rabbitmq-discuss mailing list