On 11/23/2011 09:05 AM, Toralf Lund wrote:
Hello,

Sometimes the host I'm connecting to via qpid::messaging::Connection
turns out to be down. When this is the case, the open() call may exhibit
two different kinds of behaviour, depending on the network configuration
or something:

1. An exception is raised almost immediately, and a message like
2011-11-23 09:15:44 warning Connect failed: No route to host
is logged.
2. An exception is raised after a *long* delay, and log message is
2011-11-23 09:25:01 warning Connect failed: Connection timed out

Now, case 1) is not really much of an issue, but 2) is rather
problematic because the timeout is something like 4 minutes, and I don't
want to lock up my application for that long. Questions:

1. Why is it that I sometimes get "No route to host" and at other
times have to wait for a timeout? Through what mechanism does the
system (sometimes) know or find out directly that the remote host
is missing, so that it doesn't have to wait for timeouts etc? I
realise that this is more of a general sockets or TCP question
than something specific to QPid or AMQP, but does anyone here know?
2. Is there any way to make the timeout for case 2) shorter? I tried
setting the "reconnect-timeout" option on the connection, but this
made no difference.

Set the heartbeat option, then the connection will abort if two heartbeat intervals pass with no response from the server.

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:[email protected]

Reply via email to