activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Timothy Bish <>
Subject Re: OnException is not being called properly
Date Sat, 16 Apr 2011 19:10:17 GMT
On Sat, 2011-04-16 at 11:55 -0700, archana saini wrote:
> Hello,
> I have a java application which recieve messages from a queue. Everything is
> working fine but onException is not being called properly.
> I am using activemq-5.3.2 and for application jdk1.6
> In my code, i am using the connector uri:- failover:(tcp://hostname:61630)
> Implemented exceptionListener and in onException ,written rerty connection
> code.
> ActiveMQ is on remote server and i am running application from my local
> I was trying to see the behavious of my application when ActiveMQ is not
> available or down. I tried the follwoing three scenarios:-
> 1. Disconnect network and started application, it started retrying as per
> code logic. [Pass]
> 2. Started application and it connected to ActiveMQ successfully. It
> consumed messages also. Now disconnected network, it works fine, it was
> trying to reconnect and connected when network is available[Pass]
> In logs, i can see message "WARN
> -handleTransportFailure():226 - Transport (host/host:61630) failed to
> tcp://host:61630 , attempting to automatically reconnect due to:
> Connection reset
> 16 Apr 2011 23:04:17 INFO -doReconnect():878 -
> Successfully reconnected to tcp://host:61630"
> 3. Started application , it connected to ActiveMQ successfully. Now
> disconnected network, application stops immediately. [Fail]
> Only entry in logs:- "WARN
> -handleTransportFailure():226 - Transport (host/host:61630) failed to
> tcp://host:61630 , attempting to automatically reconnect due to:
> Connection reset"
> But application stops immediately. 
> In any test case onException method is not being called. 

The whole point of the failover transport is that the transport deals
with network interruptions so your app doesn't see that there was a
connection loss.  The onException method won't be called unless you have
configured the failover transport to stop trying to reconnect after a
certain number of retries, etc.  

See the failover transport reference for configuration options:

Not sure what all your application is doing so can't say what is
happening in case three there, but perhaps with the knowledge that
onException isn't going to be called on network interrupt you can
reevaluate you code.


Tim Bish
Twitter: tabish121

Connect at CamelOne May 24-26

The Open Source Integration Conference

View raw message