首页 > 解决方案 > 使用 DefaultMessageListenerContainer 和 CachingConnectionFactory 的性能问题

问题描述

在我们的应用程序中,我们使用 SingleConnectionFactory 和 DefaultMessageListenerContainer 从 IBM MQ 服务器消费,应用程序的性能非常好,但是在 MQ 端,我们的应用程序随机打开了太多新连接。这是我们当前的配置。

标签: spring-integrationspring-jms

解决方案


试试这个而不是缓存或单个:

<bean id="connectionFactory" class="org.springframework.jms.connection.DelegatingConnectionFactory">
    <property name="targetConnectionFactory" ref="primaryRawInputConnectionFactory" />
    <property name="shouldStopConnections" value="true"/>
</bean>

推荐阅读