简体   繁体   English

设置为不存在的队列时,无限JMS消息重新交付循环

[英]Infinite JMS message redelivery loop when replyTo set to nonexistent queue

Given that I have application running in IBM WebSphere AS 8.5.5.9, connected to IBM WebSphere MQ 7.0 via JMS (resolved via JNDI), using spring-integraion-jms(4.2.5) inbound-gateway configured as follows: 假设我有运行在IBM WebSphere AS 8.5.5.9中的应用程序,并且使用spring-integraion-jms(4.2.5)inbound-gateway通过JMS连接到IBM WebSphere MQ 7.0(通过JNDI解决),配置如下:

    <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"/>

Inbound message got processed and status reply message arrives on channel channel.response.message . 入站消息已处理,状态回复消息到达通道channel.response.message When inbound message have incorrect jms_replyTo header (ie non-existent queue) following exception raises, ignoring error-channel setting (any other exceptions during integration flow handled correctly): 当入站消息具有不正确的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

Then message got rolled back, and redelivered, thus making infinite loop. 然后,邮件回滚并重新传递,从而形成无限循环。 Is there any workarounds or best practices for this issue apart from Handling poison messages in WebSphere MQ classes for JMS ? 除了在JMS的WebSphere MQ类中处理有害消息之外,是否有任何解决方法或最佳实践?

The error channel is intended to catch exceptions in the downstream flow from the gateway, the sending of the reply is not currently in the scope of the error channel handling. 错误通道旨在捕获来自网关的下游流中的异常,答复的发送当前不在错误通道处理的范围内。

Last year we extended the scope to include message conversion before the message is sent to the downstream flow, but the reply processing is still outside that scope. 去年,我们将范围扩展到在消息发送到下游流之前包括消息转换,但是答复处理仍不在该范围之内。

We could consider adding it but right now, the only work-around would be to use the poison message stuff. 我们可以考虑添加它,但是现在,唯一的解决方法是使用有毒消息。 Alternatively, if you know which replyTo queues are valid in your application, you can check the jms_replyTo header and throw an exception from your flow. 另外,如果您知道哪些replyTo队列在您的应用程序中有效,则可以检查jms_replyTo标头并从流中引发异常。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM