Just use the failover transport instead of your plain tcp transport, 
it can reconnect to the broker transparently and it will replay 
producers/consumers, the connection and pending transactions 
when reconnection is successful.
http://activemq.apache.org/failover-transport-reference.html


At 2013-06-02 20:37:36,fenbers <mark.fenb...@noaa.gov> wrote:
>If ActiveMQ is restarted, we find that our producers and our consumers have
>to be shut down and relaunched in order to reestablish the connection with
>ActiveMQ.  This is a royal pain!  However, a producer will throw an
>exception whenever it tries to send a message through a lost connection, and
>so I catch the exception where I can close the connection and reopen it. 
>Thus, my producers are able to reconnect automatically in the event ActiveMQ
>is restarted.
>
>But with a consumer, no exception is thrown as it waits for message
>notifications.  It simply waits eternally for a notification that never
>happens once a connection with ActiveMQ is lost.  So what is the recommended
>approach for a consumer to check for a disconnection?? 
>Mark
>
>
>
>--
>View this message in context: 
>http://activemq.2283324.n4.nabble.com/How-to-detect-a-consumer-s-lost-connection-tp4667733.html
>Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Reply via email to