鉴于我在IBM WebSphere AS 8.5.5.9中运行应用程序,通过JMS连接到IBM WebSphere MQ 7.0(通过JNDI解析),使用spring-integraion-jms(4.2.5)inbound-gateway配置如下: / p>
<int-jms:inbound-gateway id="requestGateway"
connection-factory="jndiConnectionFactory"
request-destination="jndiQueueInput"
request-channel="channel.request.message"
reply-channel="channel.response.message"
default-reply-destination="jndiQueueOutput"
error-channel="errorChannel"/>
已处理入站邮件,状态回复邮件到达频道channel.response.message
。
当入站消息在异常引发之后具有不正确的jms_replyTo
标头(即不存在的队列)时,忽略错误通道设置(正确处理集成流期间的任何其他异常):
WARN o.s.j.l.DefaultMessageListenerContainer - Execution of JMS message listener failed, and no ErrorHandler has been set.
com.ibm.msg.client.jms.DetailedInvalidDestinationException: JMSWMQ2008: Failed to open MQ queue 'BLABLABLA'.
at com.ibm.msg.client.wmq.common.internal.Reason.reasonToException(Reason.java:498)
at com.ibm.msg.client.wmq.common.internal.Reason.createException(Reason.java:216)
at com.ibm.msg.client.wmq.internal.WMQMessageProducer.checkJmqiCallSuccess(WMQMessageProducer.java:1086)
at com.ibm.msg.client.wmq.internal.WMQMessageProducer.checkJmqiCallSuccess(WMQMessageProducer.java:1044)
at com.ibm.msg.client.wmq.internal.WMQMessageProducer.access$800(WMQMessageProducer.java:71)
at com.ibm.msg.client.wmq.internal.WMQMessageProducer$SpiIdentifiedProducerShadow.initialise(WMQMessageProducer.java:790)
at com.ibm.msg.client.wmq.internal.WMQMessageProducer.<init>(WMQMessageProducer.java:1020)
at com.ibm.msg.client.wmq.internal.WMQSession.createProducer(WMQSession.java:926)
at com.ibm.msg.client.jms.internal.JmsSessionImpl.createProducer(JmsSessionImpl.java:1323)
at com.ibm.mq.jms.MQSession.createProducer(MQSession.java:682)
at com.ibm.ejs.jms.JMSMessageProducerHandle.<init>(JMSMessageProducerHandle.java:134)
at com.ibm.ejs.jms.JMSSessionHandle.createProducer(JMSSessionHandle.java:1869)
at org.springframework.integration.jms.ChannelPublishingJmsMessageListener.sendReply(ChannelPublishingJmsMessageListener.java:464)
at org.springframework.integration.jms.ChannelPublishingJmsMessageListener.onMessage(ChannelPublishingJmsMessageListener.java:358)
at org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:721)
at org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:681)
at org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:651)
at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:315)
at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:253)
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1158)
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1150)
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:1047)
at java.lang.Thread.run(Thread.java:785)
Caused by: com.ibm.mq.MQException: JMSCMQ0001: WebSphere MQ call failed with compcode '2' ('MQCC_FAILED') reason '2085' ('MQRC_UNKNOWN_OBJECT_NAME').
at com.ibm.msg.client.wmq.common.internal.Reason.createException(Reason.java:204)
... 21 common frames omitted
然后消息被回滚,并重新传递,从而产生无限循环。 除了Handling poison messages in WebSphere MQ classes for JMS之外,是否有针对此问题的解决方法或最佳做法?
答案 0 :(得分:0)
错误通道旨在捕获来自网关的下游流中的异常,回复的发送当前不在错误通道处理的范围内。
去年我们在将消息发送到下游流之前将范围扩展到包括消息转换,但是回复处理仍在该范围之外。
我们可以考虑添加它但是现在,唯一的解决方法是使用有害消息的东西。或者,如果您知道应用程序中哪些replyTo队列有效,您可以检查jms_replyTo
标头并从您的流中抛出异常。