1
votes

I am trying to implement a scenario where I have to create multiple durable subscribers in the same application. I want to use spring default messages listener container with ActiveMQ pooled connection factory where "maxConnection" specified to the required number of connections.

But I was going through some posts which are saying not to use pooling for durable subscriber :

http://activemq.2283324.n4.nabble.com/durable-topic-subscriber-using-spring-and-atomikos-td3209848.html http://osdir.com/ml/java.activemq.user/2005-05/msg00141.html

And I have also seen lot of posts recently about this. So my question is : Should a client use the above specified configuration (pooledConnectionFactory with maxConnection specified for multiple durable subscriber) in an application. OR durable subscriber are not supposed to be used with pooling connection factory ?

What is the correct way to configure this type of test cases?

Thanks, Steven

1

1 Answers

2
votes

It is generally unnecessary to use any kind of pooling/caching with a listener container because the connection/session is long-lived. Caching/pooling provides major benefits when connections or sessions are short-lived and repeatedly created/destroyed (such as when sending messages). The listener container keeps its session(s) open for extended periods (depending on configuration). If you configure the container to only handle a limited number of messages per session, you can use Spring's SingleConnectionFactory (a separate one per container) to avoid the overhead of creating a new connection for each session.

Further, with durable subscriptions, the clientId is set on the connection, so you really don't want some other consumer to grab a pooled connection that has already had its clientId set to some other value.