I am using spring CachingConnectionFactory as in the below configuration to cache MQ sessions. I can see that the caching is working as expected:
- it opens a single MQ connection
- creates new sessions as needed and reuses them
My application has short lived peaks in message traffic. So when there is a peak, the session size bloats and remains there long after the peak. I am looking for a way of reaping these idle sessions after a specific period of inactivity. Is there anyway to achieve this?
<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>
Aucun commentaire:
Enregistrer un commentaire