本文介绍了使用WebSphere MQ耗尽了JMS连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经配置了CachingConnectionFactory,它包装了MQTopicConnectionFactoryMQQueueConnectionFactory,每个缓存的大小都设置为10.

I have configured CachingConnectionFactory that wraps a MQTopicConnectionFactory and MQQueueConnectionFactory with cache size set to 10 each.

接下来,这些在我的应用程序中的各种Spring集成工作流中都被使用.

These are than 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.

请注意,当进程停止运行时,MQ通道上的连接计数有时会达到允许的最大值(约1000).对于生产应用程序来说这是一个严重的问题.

It is noticed that once in a while the connection count on MQ channel reaches maximum allowed (about 1000) when the process stops functioning. This is a serious problem for a production application.

关闭应用程序不会减少连接数,因此看起来像MQ端的孤立连接吗?我不确定我的spring jms/SI配置中是否缺少任何可以解决此问题的东西,我们将不胜感激.

Bringing the application down does not reduce the connection count so looks like orphaned connections on MQ side? I am not sure if I am missing anything in my spring jms / SI configuration that can resolve this issue, any help would be highly appreciated.

我也想记录从应用程序打开和关闭的连接,但没有找到实现此目的的方法.

Also I would like to log connection open and close from application but don't see a way to do that.

<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

推荐答案

您确实需要显示您的配置,但是Spring CachingConnectionFactory仅创建一个为所有会话共享的连接.在创建新连接时,打开CCF类别的INFO日志记录会发出此日志...

You really need to show your configuration but the Spring CachingConnectionFactory only creates a single connection that's shared for all sessions. Turning on INFO logging for the CCF category emits this log when a new connection is created...

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

您的配置中没有什么脱颖而出的.正如我所说,每个CCF一次最多只能打开1个连接.

There's nothing in your config that stands out. As I said, each CCF will have at most 1 connection open at a time.

如果您有空闲时间,一种可能性是网络(交换机或防火墙)可能会在不告知客户端或服务器的情况下静默断开连接.客户端下次尝试使用其连接时,它将失败并创建新的连接,但服务器可能永远不会发现旧的连接已失效.

One possibility, if you have idle times, is that the network (a switch or firewall) might be silently dropping connections without telling 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 find out that the old one is dead.

通常,在这种情况下,启用心跳或保持活动状态将使连接保持活动状态(或至少允许服务器知道它已死).

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

这篇关于使用WebSphere MQ耗尽了JMS连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 12:28