【发布时间】:2016-01-23 08:16:12
【问题描述】:
我们在我们的项目中使用 Spring Integration,并且我们有一个要求,如果 IBM MQ 出现故障,那么我们必须在它启动时自动连接到 IBM MQ。我们使用org.springframework.jms.listener.DefaultMessageListenerContainer 类的recoveryInterval 选项完成了这个实现。我们已经给出了恢复间隔值来尝试恢复 MQ 连接。但是 MQ 重启后它并没有恢复连接。以下是我现有的配置:
<jms:message-driven-channel-adapter id="adapterId" channel="raw-channel" container="messageListenerContainer" />
<bean id="messageListenerContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer">
<property name="connectionFactory" ref="customQueueCachingConnectionFactory" />
<property name="destination" ref="requestQueue" />
<property name="recoveryInterval" value="60000" />
</bean>
Below is the Current Connection Factory :
<bean id="queueCachingConnectionFactory"
class="org.springframework.jms.connection.CachingConnectionFactory">
<property name="targetConnectionFactory" ref="queueConnectionFactory" />
<property name="sessionCacheSize" value="10" />
<property name="cacheProducers" value="false" />
<!-- <property name="reconnectOnException" value="true" /> -->
<!-- <property name="exceptionListener" ref="MQExceptionListener"></property> -->
</bean>
<jee:jndi-lookup id="queueConnectionFactory" jndi-name="MQConnectionFactory"
expected-type="javax.jms.ConnectionFactory" lookup-on-startup="true"></jee:jndi-lookup>
<jee:jndi-lookup id="queue" jndi-name="Queue"
expected-type="javax.jms.Queue" lookup-on-startup="true"/>
ERROR [task-scheduler-4] LoggingHandler:145 -org.springframework.jms.IllegalStateException: MQJCA1019: The connection is closed.; nested exception is com.ibm.msg.client.jms.DetailedIllegalStateException: MQJCA1019: The connection is closed.
The application attempted to use a JMS connection after it had closed the connection.
Modify the application so that it closes the JMS connection only after it has finished using the connection.
提前致谢!!
【问题讨论】:
-
您也应该分享
ConnectionFactory配置。另外,也分享有关此事的日志。如果您说“通过 JBOSS 资源适配器”,那么问题可能就在那里,而不是在 Spring... -
@ArtemBilan:你能帮我解决上述问题吗
标签: spring-integration ibm-mq spring-jms