I have set up my DefaultMessageListenerContainer with implementation of javax.jms.MessageListener wired to it.

I use MQQueueConnectionFactory wired to cachingconnectionFactory. Have set cacheconsumers to true at DefaultMessageListenerContainer and have set sessionCacheSize to be equivalent to number of concurrentconsumers.

I see that , when concurrentconsumers is set to 10 , ten JMS sessions are created from a single JMS Connection. Is there a way to create the JMS sessions from 10 different JMS connections?

Please advise.

1

There are 1 best solutions below

1
On

Not when using the caching connection factory, it is a subclass of SingleConnectionFactory; use the vendor connection factory directly if you want separate connections. Why do you want/need separate connections anyway?

It is generally not necessary to use a CCF with a listener container because the sessions are long-lived, and, in any case, caching consumers can cause issues if you use variable concurrency.

See this answer for a more detailed explanation.