Closing Session when using Spring's CachingConnectionFactory

后端 未结 2 1413
礼貌的吻别
礼貌的吻别 2021-01-02 12:20

The java doc here related to Spring CachingConnectionFactory has comment :

NOTE: This ConnectionFactory requires explicit closing of all Sessions obta

2条回答
  •  长发绾君心
    2021-01-02 12:42

    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.

提交回复
热议问题