Hello,

There is a Qpid specific ConnectionListener that can be registered on the 
Connection object that will hear failover events.  (This is distinct from the 
ExceptionListener provided by JMS)

To register, implement the ConnectionListener interface, cast the JMS 
Connection object back to its AMQConnection implementation class and invoke:

org.apache.qpid.client.AMQConnection#setConnectionListener(org.apache.qpid.jms.ConnectionListener)
Hope this helps,  

Keith Wall.


On 24 Nov 2011, at 14:06, Fraser Adams <[email protected]> wrote:

> Hi all,
> I've been using the JMS auto reconnection feature e.g. with a brokerList 
> containing:
> 
> tcp://localhost:5672?connectdelay='5000'&retries='2147483647'
> 
> which is working very nicely, but I've got a perhaps slightly obtuse question 
> :-)
> 
> The auto reconnect is nicely transparent to clients, which is generally what 
> I'd like, but I was musing that it might be useful to be able to intercept 
> the fact that there has been a disconnection so that my client can perhaps do 
> some cleanup or reinitialise some state waiting for the new connection.
> 
> I've enabled log INFO and I'm seeing exceptions on things like 
> "apache.qpid.client.AMQConnection" and 
> "qpid.jms.failover.FailoverSingleServer" which are clearly being caught 
> internally as part of the reconnection logic.
> 
> So my application isn't seeing anything, which for the most part is useful - 
> but is there any way for me to identify that the broker has disconnected 
> short of having my own retry logic - which seems undesirable.
> 
> 
> Any thoughts?
> Cheers,
> Frase
> 
> ---------------------------------------------------------------------
> Apache Qpid - AMQP Messaging Implementation
> Project:      http://qpid.apache.org
> Use/Interact: mailto:[email protected]
> 

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

Reply via email to