Spring integration 使用spring集成进行JMS连接时出错

Spring integration 使用spring集成进行JMS连接时出错,spring-integration,spring-jms,Spring Integration,Spring Jms,我们使用带有错误通道的jms消息驱动适配器从MQServer传输消息: <int:publish-subscribe-channel id="processChannel1" /> <int:logging-channel-adapter channel="processChannel1" logger-name="log_channel" level="ERROR" expression=&

我们使用带有错误通道的jms消息驱动适配器从MQServer传输消息:

<int:publish-subscribe-channel id="processChannel1"  />  
<int:logging-channel-adapter channel="processChannel1" logger-name="log_channel" level="ERROR" expression="payload" />
<int:service-activator input-channel="processChannel1"  ref="channelUtils" output-channel="error1" method="treatment" />


<bean id="myListener" class="org.springframework.jms.listener.DefaultMessageListenerContainer" >
    <property name="autoStartup" value="false" />
    <property name="connectionFactory" ref="connectionFactoryCaching" />
    <property name="destination" ref="jmsQueue" />
    <property name="maxMessagesPerTask" value="1" />
    <property name="receiveTimeout" value="1" />
    <property name="backOff" ref="fixedBackOff" />
    <property name="sessionTransacted" value="true"/>
    <property name="errorHandler" ref="connectionJmsHandler"/> 
</bean> 

<int-jms:message-driven-channel-adapter id="jmsIn" container="myListener" channel="channelMQ_RMQ" error-channel="processChannel1"/>
当JMS连接上出现此类错误时,是否有方法调用特定的处理

谢谢你的帮助

问候,


Eric

您可以向
DefaultMessageListenerContainer
添加一个
ExceptionListener
,并在那里处理连接异常

2021-03-16 16:47:05.050 [myListener-5669] ERROR o.s.j.l.DefaultMessageListenerContainer - Could not refresh JMS Connection for destination 'queue://QM1/QUEUE.IN.3?CCSID=819&persistence=2&targetClient=1&priority=0' - retrying using FixedBackOff{interval=5000, currentAttempts=0, maxAttempts=1}. Cause: JMSWMQ0018: Failed to connect to queue manager 'QM1' with connection mode 'Client' and host name '10.118.121.78(8081)'.; nested exception is com.ibm.mq.MQException: JMSCMQ0001: WebSphere MQ call failed with compcode '2' ('MQCC_FAILED') reason '2538' ('MQRC_HOST_NOT_AVAILABLE').
2021-03-16 16:47:10.055 [myListener-5669] ERROR o.s.j.l.DefaultMessageListenerContainer - Could not refresh JMS Connection for destination 'queue://QM1/QUEUE.IN.3?CCSID=819&persistence=2&targetClient=1&priority=0' - retrying using FixedBackOff{interval=5000, currentAttempts=1, maxAttempts=1}. Cause: JMSWMQ0018: Failed to connect to queue manager 'QM1' with connection mode 'Client' and host name '10.118.121.78(8081)'.; nested exception is com.ibm.mq.MQException: JMSCMQ0001: WebSphere MQ call failed with compcode '2' ('MQCC_FAILED') reason '2538' ('MQRC_HOST_NOT_AVAILABLE').
2021-03-16 16:47:10.055 [myListener-5669] ERROR o.s.j.l.DefaultMessageListenerContainer - Stopping container for destination 'queue://QM1/QUEUE.IN.3?CCSID=819&persistence=2&targetClient=1&priority=0': back-off policy does not allow for further attempts.