[rabbitmq-discuss] connecting to multiple rabbitmq servers (point-multipoint)
Matthias Radestock
matthias at lshift.net
Mon Feb 8 21:01:32 GMT 2010
Guillem,
Guillem Corominas wrote:
> Yesterday I noticed that when the consumer stops receiving messages, the
> rabbitmqctl list_connections shows that the connection no longer exists.
> However in the Java Client, the Connection object and it's associated
> Channel objects don't seem to notice about that. I tried logging it's
> status by printing if either the Connection or the Channel is null, or
> if any of those isOpen(), but they says they are both open. The client
> doesn't seem to notice that the connection is down.
What you are seeing is not uncommon in TCP/IP networks - it can take a
while (minutes, sometimes hours) for both sides of a dead connection to
realise the connection is down.
> How can I ask the client about the connection in order to realize that
> it's eventually down and it needs to be reconnected?
AMQP contains a mechanism to deal with the above situation: heartbeats.
By default they are turned off but can be enabled by the client during
connection establishment. See
http://www.rabbitmq.com/releases/rabbitmq-java-client/v1.7.1/rabbitmq-java-client-javadoc-1.7.1/http://www.rabbitmq.com/releases/rabbitmq-java-client/v1.7.1/rabbitmq-java-client-javadoc-1.7.1/com/rabbitmq/client/ConnectionParameters.html#setRequestedHeartbeat(int)
Regards,
Matthias.
More information about the rabbitmq-discuss
mailing list