【发布时间】:2015-05-24 08:16:48
【问题描述】:
我在下面的配置中使用 spring CachingConnectionFactory 来缓存 MQ 会话。我可以看到缓存按预期工作:
- 它打开单个 MQ 连接
- 根据需要创建新会话并重复使用它们
我的应用程序的消息流量高峰期很短。因此,当出现峰值时,会话大小会膨胀并在峰值后很长时间保持在那里。我正在寻找一种在特定时间不活动后获得这些空闲会话的方法。有没有办法做到这一点?
<jee:jndi-lookup id="mqQueueConnectionFactory" jndi-name="java:comp/env/jms/MyJMSQueueConnectionFactory" />
<bean id="userConnectionFactory" class="org.springframework.jms.connection.UserCredentialsConnectionFactoryAdapter">
<property name="targetConnectionFactory" ref="mqQueueConnectionFactory"></property>
</bean>
<bean id="queueConnectionFactory" class="org.springframework.jms.connection.CachingConnectionFactory">
<property name="targetConnectionFactory" ref="userConnectionFactory"></property>
<property name="reconnectOnException" value="${ssa.mq.cachesession}"></property>
<property name="cacheProducers" value="${ssa.mq.cacheproducer}"></property>
<property name="sessionCacheSize" value="${ssa.mq.producer.sessionsize}"></property>
<property name="cacheConsumers" value="${ssa.mq.cacheconsumers}"></property>
</bean>
【问题讨论】:
标签: jms connection-pooling spring-integration ibm-mq spring-jms