[rabbitmq-discuss] Shutdown Listener on Java Client API

Matthias Radestock matthias at rabbitmq.com
Tue Sep 28 22:08:04 BST 2010


Dave,

Dave Greggory wrote:
> We had something similar happen again last night. For some reason, one of our 
> producers lost the connection to RabbitMQ at 7:47 PM

How did you observe this?

> but the shutDownCompleted event did not fire on that producer till 8:58 PM.

It's possible for a stale network connection to go undetected for a long 
time. The presence of firewalls and loadbalancers in the path seems to 
increase the likelihood of this happening.

> Any thoughts? Is there something in the java client api that could prevent the 
> shutdownEvent from firing quickly?

No. The most likely cause is that the tcp stack simply took that long to 
  notice the connection was dead.

> AMQP Heartbeats were mentioned in another thread, would that help and
> how do we enable these?

Yes, heartbeats would help. Enable them with 
http://www.rabbitmq.com/releases/rabbitmq-java-client/v2.1.0/rabbitmq-java-client-javadoc-2.1.0/com/rabbitmq/client/ConnectionFactory.html#setRequestedHeartbeat(int)

You could also try playing with TCP's Keepalive settings.


Regards,

Matthias.


More information about the rabbitmq-discuss mailing list