Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-core/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring integration Spring JMS出站网关接收超时被忽略_Spring Integration_Spring Jms - Fatal编程技术网

Spring integration Spring JMS出站网关接收超时被忽略

Spring integration Spring JMS出站网关接收超时被忽略,spring-integration,spring-jms,Spring Integration,Spring Jms,我有一个Spring集成流,它通过配置为接收超时45秒的JMS出站网关发送消息。我试图通过在设置中发送消息来测试接收超时时间,在该设置中,消息从未在另一端被使用(因此不会返回响应)。但是,当我运行测试时,消息被放置在出站队列中,但是出站网关的接收超时从未发生(45秒后)。你知道这种情况发生(没有发生)的原因是什么吗 我的堆栈是: o.s.i:spring-integration-java-dsl:1.0.0.M3 o.s.i:spring-integration-jms:4.0.4.RELEAS

我有一个Spring集成流,它通过配置为接收超时45秒的JMS出站网关发送消息。我试图通过在设置中发送消息来测试接收超时时间,在该设置中,消息从未在另一端被使用(因此不会返回响应)。但是,当我运行测试时,消息被放置在出站队列中,但是出站网关的接收超时从未发生(45秒后)。你知道这种情况发生(没有发生)的原因是什么吗

我的堆栈是:

o.s.i:spring-integration-java-dsl:1.0.0.M3
o.s.i:spring-integration-jms:4.0.4.RELEASE
My IntegrationgConfig.class:

@Configuration
@EnableIntegration
public class IntegrationConfig {

    ...

    @Bean
    public IntegrationFlow testFlow() {

        return IntegrationFlows
            .from("test.request.ch")
            .handle(Jms.outboundGateway(connectionFactory)
                    .receiveTimeout(45000)
                    .requestDestination("REQUEST_QUEUE")
                    .replyDestination("RESPONSE_QUEUE")
                    .correlationKey("JMSCorrelationID"))
            .handle("testService",
                    "testMethod")
            .channel("test.response.ch").get();
    }

    ...
}
就JMS配置而言,使用的连接工厂是一个标准的CachingConnectionFactory,它以MQConnectionFactory为目标

提前感谢您在这方面的帮助。 首相

---更新---

我已打开调试,可以看到当超时发生时,会记录以下消息:

AbstractReplyProducingMessageHandler - handler 'org.springframework.integration.jms.JmsOutboundGateway#0' produced no reply for request Message: [Payload byte[835]][...]
只需要了解如何在流中捕获此事件

---更新2---

正在发送的消息上设置了一个ERROR_CHANNEL头,我希望超时异常会被路由到该头,但该路由不会发生


是否可能是CachingConnectionFactory正在处理异常而没有将其传递回流?

要使其正常工作,您需要使用
Jms将第二个Lambda添加到
.handle()

.handle(Jms.outboundGateway(connectionFactory)
                .receiveTimeout(45000)
                .requestDestination("REQUEST_QUEUE")
                .replyDestination("RESPONSE_QUEUE")
                .correlationKey("JMSCorrelationID"),
        e -> e.requiresReply(true))
默认情况下,
AbstractReplyProducingMessageHandler
不需要
reply
,即使
receiveTimeout
已用尽,我们可以从您显示的日志中看到这一点

但是,我看到我们应该修改所有的
MessageHandlerSpec
s,因为XML支持将某些组件的
requires reply
默认更改为
true

请随时就此事提出建议,我们将很快解决,因为Java DSL的
GA
发布计划将在一两周内完成:


谢谢你对这些东西的关注

嗨@Artem,这很有效。我会按要求养一只吉拉。谢谢