Spring integration JMS出站网关响应读取限制

Spring integration JMS出站网关响应读取限制,spring-integration,spring-jms,Spring Integration,Spring Jms,我有一个JMS出站网关,它通过请求队列发送消息,通过响应队列接收消息。我想知道对响应队列之外的消息的接收部分应用节流的最简单方法是什么。我曾尝试将轮询器设置为出站网关,但设置后,响应消息根本不会被使用。是否可以在出站网关中使用轮询器来限制消息消耗?如果是,怎么做?如果不是,我如何才能最好地限制消息响应消耗 我的堆栈是: o.s.i:spring-integration-java-dsl:1.0.0.RC1 o.s.i:spring-integration-jms:4.0.4.RELEASE M

我有一个JMS出站网关,它通过请求队列发送消息,通过响应队列接收消息。我想知道对响应队列之外的消息的接收部分应用节流的最简单方法是什么。我曾尝试将
轮询器设置为出站网关,但设置后,响应消息根本不会被使用。是否可以在出站网关中使用
轮询器来限制消息消耗?如果是,怎么做?如果不是,我如何才能最好地限制消息响应消耗

我的堆栈是:

o.s.i:spring-integration-java-dsl:1.0.0.RC1
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"), e -> {
                    e.requiresReply(true);
                    e.poller(Pollers.fixedRate(1000).maxMessagesPerPoll(2)); // when this poller is set, response messages are not consumed at all...
                })
            .handle("testService",
                    "testMethod")
            .channel("test.response.ch").get();
    }

    ...
}
干杯,
PM

因为您要从
响应队列中获取消息,
.poller()
对您没有帮助

如果我们的端点的
输入通道
(在您的案例中
test.request.ch
)是
可轮询通道,我们需要
轮询器
。关于这件事,见文件

Jms.outboundGateway
上有
.replyContainer()
选项供您选择。使用它,您可以配置
concurrentConsumers
选项,以在
响应队列
上获得更好的吞吐量


否则,
JmsOutboundGateway
将为每个请求消息创建
MessageConsumer

将SI流作为一个整体进行了审查,并且基本上与您所说的内容一致。。。事实证明,我们根本不需要限制JMS出站网关。相反,我们现在通过设置轮询器和ThreadPoolExecutor(在上面的代码片段中未显示!),在整个流的开始处限制初始JMS入站适配器。我想这与您在输入通道上设置轮询器的意思是同义的。谢谢你的贴士!对的因为
入站通道适配器
也是可轮询的。请参见
AbstractPollingEndpoint
及其实现。他们需要
轮询器