问题
I have 3 servers - 2 servers running identical spring integration applications and 1 websphere MQ server. Both applications connect to the same topic.
After what seems like an unpredictable amount of time (sometimes hours, sometimes days) both applications stop receiving messages. This failure occurs on both applications at approximately the same time. The applications require a restart in order to recover.
Both applications have the following config:
<bean id="jmsInputFactory" class="com.ibm.mq.jms.MQTopicConnectionFactory">
<property name="queueManager" value="MyQM" />
<property name="hostName" value="x.x.x.x" />
<property name="port" value="15004" />
<property name="transportType" value="1" />
<property name="channel" value="MYCHANNEL" />
<property name="clientId" value="${system.description}"></property>
</bean>
<bean id="cachedConnectionFactory" class="org.springframework.jms.connection.CachingConnectionFactory">
<property name="targetConnectionFactory" ref="jmsInputFactory"></property>
</bean>
<bean id="jmsDestinationResolver"
class="org.springframework.jms.support.destination.DynamicDestinationResolver" />
<jms:message-driven-channel-adapter
channel="myChannel"
connection-factory="cachedConnectionFactory"
destination-resolver="jmsDestinationResolver"
pub-sub-domain="true"
destination-name="MYTOPIC" />
I can't seem to find any error message anywhere and am at a loss for how to go about further investigation. Does anyone have any suggestions?
回答1:
This is a common problem; some networks (firewalls, routers) silently drop idle connections; if the vendor client is not informed of the socket closure, then no exception is propagated up the stack to force a reconnect.
The usual solution to these issues is to enable heartbeats of some kind to keep idle sockets active (from the network's perspective). Refer to your JMS vendor's documentation on how to set that up.
来源:https://stackoverflow.com/questions/23568364/permanent-jms-connection-failure-but-no-error