I am using the JMS connector in Mule for MQ operations. I am using direct JMS connection option in my codebase and noticed whenever Mule post message to MQ then that connection is not getting closed. Also noticed if i post bulk messages like 10K then connections got established more like 500 but not getting closed automatically.
Below is the code snippet -
<spring:beans>
<spring:bean id="JmsFactory" name="JmsFactory" class="com.ibm.mq.jms.MQConnectionFactory">
<spring:property name="hostName" value="XXXX"/>
<spring:property name="port" value="XXXX"/>
<spring:property name="queueManager" value="XXXX"/>
<spring:property name="transportType" value="1"/>
<spring:property name="channel" value="XXXX"/>
</spring:bean>
</spring:beans>
<jms:connector name="jmsconnector" username="XXXX" password="XXXX" validateConnections="true" numberOfConsumers="1" persistentDelivery="true" specification="1.1" connectionFactory-ref="JmsFactory"/>
<jms:outbound-endpoint queue="SOURCE.IN" connector-ref="jmsconnector" />
Can anyone suggest how effectively we can close the connection once Mule post the message to MQ.
You can set useCacheSessions=false to close the JMS connection after the MQ commit.
<jms:connector name="jmsconnector" username="XXXX" password="XXXX" validateConnections="true" numberOfConsumers="1" persistentDelivery="true" specification="1.1" connectionFactory-ref="JmsFactory" cacheJmsSessions="false" />