Spring integration 未接收回复消息

Spring integration 未接收回复消息,spring-integration,Spring Integration,我没有向目标队列发送消息,因此我最终得到MessageTimeoutException 我尝试了一个非常有效的方法,并发送了消息,确保我在请求通道上获得了正确的消息 我还在日志中看到我的出站gatway正在requestCh1上接收消息。 org.springframework.integration.jms.JmsOutboundGateway0收到消息:[有效负载…] 我真的被卡住了,无法理解为什么jms出站网关不向目标队列发送消息 有人帮忙吗 配置: <int:publish-sub

我没有向目标队列发送消息,因此我最终得到MessageTimeoutException

我尝试了一个非常有效的方法,并发送了消息,确保我在请求通道上获得了正确的消息

我还在日志中看到我的出站gatway正在requestCh1上接收消息。 org.springframework.integration.jms.JmsOutboundGateway0收到消息:[有效负载…]

我真的被卡住了,无法理解为什么jms出站网关不向目标队列发送消息

有人帮忙吗

配置:

<int:publish-subscribe-channel id="requestCh1" />

<int:service-activator input-channel="requestCh1" ref="processor" method="processMsg"/>
<bean id="processor" class="com.processor.ProcessorImpl" />

<int-jms:outbound-gateway 
            id="eventPublisherGateway"
            connection-factory="myConnectionFactory"
            request-channel="requestCh1"
            request-destination="qequestQueue"
            reply-channel="responseCh1" 
            reply-destination="responseQueue" 
            receive-timeout="20000">
</int-jms:outbound-gateway>
添加此网关正在发送的具有相关id的JMS消息

JMS消息类:JMS\u text

JMSType:         null
  JMSDeliveryMode: 2
  JMSExpiration:   0
  JMSPriority:     4
  JMSMessageID:    ID:414d5120414344534430513720202020537502dd201b6c02
  JMSTimestamp:    1405462485258
  JMSCorrelationID:bf566441-8ccb-4620-afac-941cc4842a61
  JMSDestination:  queue://QMGR01/REQUESTQ
  JMSReplyTo:      queue://QMGR01/RESPONSEQ
  JMSRedelivered:  false
  JMSXDeliveryCount:0
  JMSXAppID:Websphere MQ Client for Java
  JMS_IBM_PutApplType:28
  timestamp:1405462384810
  sequenceNumber:3
  JMSXUserID:mqcls1      
  sequenceSize:4
  JMS_IBM_PutTime:22574883
  JMS_IBM_PutDate:20140715
<?xml version="1.0" encoding="UTF-8" standalone="no"?><Employee><empId>567</empId></<Employee>

因为您说您获得了MessageTimeoutException,而JmsOutboundGateway中只有一个位置:

if (jmsReply == null) {
    if (this.requiresReply) {
        throw new MessageTimeoutException(message,
                "failed to receive JMS response within timeout of: " + this.receiveTimeout + "ms");
    }
    else {
        return null;
    }
}
因此,您的问题是围绕回复而不是请求。 我的意思是你正确地将消息发送到目的地,但对方没有向你发送回复到responseQueue目的地

如果您对请求/回复场景不感兴趣,并且只需要发送消息,则可以切换到

如果这不是事实,请显示StackTrace以查看MessageTimeoutException的原因

更新

这可能是因为JmsCorrelationId吗

是的,它可以。另一部分必须使用请求中的值支持JMSCorrelationID属性

JmsOutboundGateway通过选择器执行关联:


谢谢你的回复。我删除了我以前的评论,因为在请求队列上发送消息未被记录,但我签入了实际发送的消息。此外,我还编写了另一个独立的侦听器容器,侦听同一队列,我的出站网关应该在该队列中接收回复,并在我发送时立即接收回复。此外,我还必须使用网关,所以任何想法可能是我的错误?请检查主帖子stacktrace。如果有独立的侦听器,它会窃取消息为您的网关!因为responseQueue是一个队列,所以只有一个侦听器可以从队列中获取消息。把它取下来怎么样-我知道,创建独立侦听器只是为了测试,只是为了检查我的消息的接收者是否正在发送回复。当我的jms出站网关运行时,我关闭了独立侦听器。如果你不控制使用者部分,你就不能处理相关性。正当使用者必须使用请求中的correlationId向应答目的地发送应答。否则制作人就不工作了。
if (jmsReply == null) {
    if (this.requiresReply) {
        throw new MessageTimeoutException(message,
                "failed to receive JMS response within timeout of: " + this.receiveTimeout + "ms");
    }
    else {
        return null;
    }
}
messageSelector = "JMSCorrelationID = '" + correlationId + "'";
...
messageConsumer = session.createConsumer(replyTo, messageSelector);