activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Rosenberg <>
Subject Re: Timeout and Failover on a queue
Date Tue, 27 Nov 2007 11:49:47 GMT


In this case, I am creating a connection for the purspose of sending a
message (so not a message listener).  I am using the Spring JmsOperations
template, and just injecting the connectionFactory property  for the
jmsOperations object on initialization.

The connectionFactory is org.jencks.amqpool.PooledConnectionFactory.  I
presume it's up to the factory code to properly dispose of the failed
connection's resources.  I also had the same result configuring it with the
ActiveMQ factory, org.apache.activemq.pool.PooledConnectionFactory.

In each case the pooled connection factories in turn use a
'connectionFactory' object of

What I've noticed is that this configuration works fine, if I use a simple
TcpTransport.  That is, if the connection fails, the connection factory
seems to dispose of the resources and create a fresh one for the next
attempt, and so it recovers quickly when the broker recovers.

Somehow, the FailoverTransport must fail in a different way, since the
connection factory doesn't detect that it needs to remove it and create a
new object on the next request.

Finally, I've also seen that the FailoverTransport, if configured without
maxReconnectAttempts, doesn't shutdown cleanly, if there's no broker
present.  It hangs, or throws an exception.   I provide the
destroy-method="stop" on the pooled connection factory object.

Thanks for any help,


James.Strachan wrote:
> On 26/11/2007, Jason Rosenberg <> wrote:
>> I'm curious whether you've found a solution to this.  I've seen also that
>> if
>> you use the maxReconnectAttempts, and it fails to reconnect, then the
>> connection cannot be reliably recovered.
> If a connection fails to reconnect it must be discarded (along with
> all of its associated resources). e.g. imagine a JDBC connection when
> a database goes down - its of no real use any more
>> I've tried it with the Jencks AMQPool for my connection pooling, as well
>> as
>> the standard ActiveMQ PooledConnections....
>> And if you don't use the maxReconnectAttempts flag, then it retries
>> forever,
>> and hangs the client.
>> So, I'd be interested to know if there's a way to have it recover cleanly
>> on
>> failure, but always return quickly to the client if all failover choices
>> have failed....
> Does switching to Spring's MessageListenerContainer stuff instead of
> the Jencks pool help? Basically the pool must ditch the connections,
> sessions & consumers if the connection fails.
> -- 
> James
> -------
> Open Source Integration

View this message in context:
Sent from the ActiveMQ - User mailing list archive at

View raw message