The java doc here related to Spring CachingConnectionFactory has comment :
NOTE: This ConnectionFactory requires explicit closing of all Sessions obta
It is generally not a good idea to use a caching connection factory with a listener container, especially when using maxConcurrentConsumers
> concurrentConsumers
- you can end up with cached consumers in the cache, which get messages where there is no listener, and such messages can get "stuck".
So, don't use a CCF
in this case, it's really intended for use on the producer side.
Since the container manages concurrency, the sessions/consumers are long-lived and don't need to be cached.