JMS connections exhausted using WebSphere MQ

I have configured CachingConnectionFactory

that wraps MQTopicConnectionFactory

and MQQueueConnectionFactory

with a cache size of 10.

They are used in several jms:outbound-channel-adapter or jms:message-driven-channel-adapter

as part of various spring integration workflows that I have in my application.

It is noticed that the connection time on the MQ channel reaches the maximum allowed (about 1000) when the process stops functioning. This is a major issue for a production application.

Bringing the application down doesn't reduce the number of connections, so it looks like orphan connections on the MQ side? I'm not sure if I am missing anything in my spring jms / SI config that can fix this problem, any help would be much appreciated.

Also I would like to connect to the application opening and closing protocol, but I don't see a way to do it.

<bean id="mqQcf" class="com.ibm.mq.jms.MQQueueConnectionFactory">
//all that it needs host/port/ queue manager /channel
</bean>
 
 <bean id="qcf" class="org.springframework.jms.connection.CachingConnectionFactory">
			<property name="targetConnectionFactory" ref=" mqQcf "/>
			<property name="sessionCacheSize" value="10"/>			
</bean>


<bean id="mqTcf" class="com.ibm.mq.jms.MQTopicConnectionFactory">
//all that it needs host/port/ queue manager /channel
</bean>

<bean id="tcf" class="org.springframework.jms.connection.CachingConnectionFactory">
			<property name="targetConnectionFactory" ref=" mqTcf "/>
			<property name="sessionCacheSize" value="10"/>			
</bean>

//Qcf and tcf are than used in spring integration configuration as required
      

Run codeHide result


thank

+3


source to share


2 answers


You really need to show your configuration, but Spring CachingConnectionFactory

only creates one connection that will be used for all sessions. Enabling log INFO

for category CCF emits this log when a new connection is created ...

if (logger.isInfoEnabled()) {
    logger.info("Established shared JMS Connection: " + this.target);
}

      

EDIT:



Nothing is highlighted in your configuration. As I said, each CCF will have no more than 1 connection at a time.

One possibility, if you have downtime, is that the network (switch or firewall) can silently drop connections without informing the client or server. The next time the client tries to use its connection, it will fail and create a new one, but the server may never know the old one is dead.

Typically, for such situations, enabling heartbeats or keepalives will keep the connection active (or at least let the server know it's dead).

+1


source


I was debugging a similar issue in my application about the number of open output counters in MQ when only the connection is open when the factory is connected.

The number of numbers to display in the MQ explorer is the number of connection handles generated by the IBM MQ classes. See the IBM documentation. The Session object encapsulates an IBM MQ connection handle, which therefore defines the transnational scope of the session.

Since the session cache size was 10 in my application, 10 IBM MQ connection handles were created (one for each session) that were open for several days and the state of the handle was inactive.

More information can be found in the section

https://www.ibm.com/support/knowledgecenter/en/SSFKSJ_9.0.0/com.ibm.mq.dev.doc/q031960_.htm



As Gary Russell pointed out, Spring does not provide a way to configure timeouts for these idle connections. IBM has built-in properties in the MQConnectionFactory that can be configured to set reconnection timeouts.

More information can be found in

https://www.ibm.com/developerworks/community/blogs/messaging/entry/simplify_your_wmq_jms_client_with_automatic_client_reconnection19?lang=en

Reconnecting to the default exception is true for CCF. Therefore, be careful if IBM throws an exception after a time interval. I'm not sure if there is a maximum number of reconnections before throwing an exception in CCF.

0


source







All Articles