activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <>
Subject Re: Transport Exceptions close the connection
Date Mon, 21 May 2007 16:34:27 GMT
On 5/21/07, Adrian Tarau <> wrote:
> Hello,
> I have the following problem : A connection(embedded broker, vm transport)
> is created and then a few sessions. I poll for messages, with my own threads
> in order to do throttling. One thing that confuses me is : if an exception
> occurs somewhere in the transport(for example an interrupt on the consuming
> thread) , the connection is closed with all the sessions and
> consumers/producers.

AFAIK thread interupt exceptions won't close a
connection/session/transport. You sure its not some other underlying

> I was able to listen for such an exceptions(with
> Connection.setExceptionListener(...)) and recreate the connection. I tried
> also with connectionFactory.setBrokerURL("failover:vm://localhost") which
> supposed to fix problems like this one, and to reconnect, but is not working
> as espected.

When using vm:// you should never really need failover, since the
broker is in the same JVM. Failover is intended for use with TCP where
a remote broker may fail.

Even if you were having a transport level exception (which shouldn't
really happen with vm:// but maybe there's a bug & we should catch &
handle InteruptedException better) then failover does the re-creation
of all the connection/sessions for you so there's no real point trying
to replicate that yourself (as you'll be opening all kinds of cans of
worms, like figuring out which messages, transactions &
acknowledgements were in progress & re-submitting them - all of which
failover: already handles.

BTW 4.0.2 is quite old, I'd recommend upgrading to 4.1.1

View raw message