我正在使用 spring integration 4.1.0 使用 jms-int:message-driven-channel-adapter 实现来自 TIBCO EMS 队列的消息消费
我有 9 个不同的消息驱动通道适配器在不同队列中的不同服务器上侦听。
下面是如何定义消息驱动的通道适配器
<int-jms:message-driven-channel-adapter
id="mdca1" connection-factory="connectionFactory1"
channel="jmsChannel1" destination="queueName1"
error-channel="errorChannel" max-concurrent-consumers="5" auto-startup="true"/>
<int-jms:message-driven-channel-adapter
id="mdca2" connection-factory="connectionFactory2"
channel="jmsChannel2" destination="queueName2"
error-channel="errorChannel" max-concurrent-consumers="5" auto-startup="true"/>
<bean id="connectionFactory1" class="org.springframework.jms.connection.CachingConnectionFactory">
<property name="targetConnectionFactory" ref="tcf1"/>
<property name="sessionCacheSize" value="${sessionCacheSize}"/>
<property name="cacheProducers" value="${cacheProducers}"/>
<property name="cacheConsumers" value="${cacheConsumers}"/>
</bean>
<bean id="tcf1" class="${connectionFactoryClassName}">
<property name="serverUrl" value="${serverUrl1}" />
<property name="userName" value="${username1}" />
<property name="userPassword" value="${password1}" />
</bean>
<bean id="connectionFactory2" class="org.springframework.jms.connection.CachingConnectionFactory">
<property name="targetConnectionFactory" ref="tcf2"/>
<property name="sessionCacheSize" value="${sessionCacheSize}"/>
<property name="cacheProducers" value="${cacheProducers}"/>
<property name="cacheConsumers" value="${cacheConsumers}"/>
</bean>
<bean id="tcf2" class="${connectionFactoryClassName}">
<property name="serverUrl" value="${serverUrl2}" />
<property name="userName" value="${username2}" />
<property name="userPassword" value="${password2}" />
</bean>
我将我的应用程序部署在 Tomcat 上,一切正常。所有适配器从队列中读取消息并发送处理。
但是由于某种原因,过了一段时间后,消息没有从队列中取出。目前我必须重新启动 tomcat 才能让适配器再次工作。我在 UI 中有一个按钮来启动/停止适配器,但是一旦适配器停止从队列中挑选消息,该按钮就不起作用。当适配器选择消息时,开始/停止按钮也可以正常工作。我可以停止并且适配器停止挑选消息,我可以开始并且适配器开始挑选消息。问题是当我的适配器运行一段时间后,说 5 - 10 小时后,队列中有一条消息,即使处于运行状态,适配器也没有选择。然后按钮也停止工作。
任何人都可以帮助可能是什么问题?为什么适配器在 5-10 小时后会出现故障?
非常感谢任何帮助。
更新:这是侦听器失败时来自 jstack 的堆栈跟踪。
"TIBCO EMS TCPLink Reader (Server-15108908)" daemon prio=10 tid=0x00007f1874115000 nid=0xc8f runnable [0x00007f18b2f1d000]
java.lang.Thread.State: RUNNABLE
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:152)
at java.net.SocketInputStream.read(SocketInputStream.java:122)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:235)
at java.io.BufferedInputStream.read(BufferedInputStream.java:254)
- locked <0x00000006c2d8ea68> (a java.io.BufferedInputStream)
at java.io.DataInputStream.readInt(DataInputStream.java:387)
at com.tibco.tibjms.TibjmsxLinkTcp._readWireMsg(TibjmsxLinkTcp.java:625)
at com.tibco.tibjms.TibjmsxLinkTcp$LinkReader.work(TibjmsxLinkTcp.java:280)
at com.tibco.tibjms.TibjmsxLinkTcp$LinkReader.run(TibjmsxLinkTcp.java:259)
"org.springframework.jms.listener.DefaultMessageListenerContainer#1-5" prio=10 tid=0x00000000019de000 nid=0xc8e in Object.wait() [0x00007f18b301e000]
java.lang.Thread.State: TIMED_WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x00000006c2eabdf8> (a java.lang.Object)
at com.tibco.tibjms.TibjmsxSessionImp._getSyncMessage(TibjmsxSessionImp.java:2288)
at com.tibco.tibjms.TibjmsxSessionImp._receive(TibjmsxSessionImp.java:2122)
- locked <0x00000006c2eabdf8> (a java.lang.Object)
at com.tibco.tibjms.TibjmsMessageConsumer._receive(TibjmsMessageConsumer.java:276)
at com.tibco.tibjms.TibjmsMessageConsumer.receive(TibjmsMessageConsumer.java:481)
at org.springframework.jms.connection.CachedMessageConsumer.receive(CachedMessageConsumer.java:82)
at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveMessage(AbstractPollingMessageListenerContainer.java:413)
at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:293)
at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:246)
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1142)
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1134)
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:1031)
at java.lang.Thread.run(Thread.java:745)
"org.springframework.jms.listener.DefaultMessageListenerContainer#3-2" prio=10 tid=0x00007f18ac001000 nid=0xc8d in Object.wait() [0x00007f18b311f000]
java.lang.Thread.State: TIMED_WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x00000006c2e30270> (a java.lang.Object)
at com.tibco.tibjms.TibjmsxSessionImp._getSyncMessage(TibjmsxSessionImp.java:2288)
at com.tibco.tibjms.TibjmsxSessionImp._receive(TibjmsxSessionImp.java:2122)
- locked <0x00000006c2e30270> (a java.lang.Object)
at com.tibco.tibjms.TibjmsMessageConsumer._receive(TibjmsMessageConsumer.java:276)
at com.tibco.tibjms.TibjmsMessageConsumer.receive(TibjmsMessageConsumer.java:481)
at org.springframework.jms.connection.CachedMessageConsumer.receive(CachedMessageConsumer.java:82)
at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveMessage(AbstractPollingMessageListenerContainer.java:413)
at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:293)
at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:246)
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1142)
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1134)
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:1031)
at java.lang.Thread.run(Thread.java:745)
任何意见?