概述

版本 5.0.1 引入了轮询通道适配器,允许您按需获取单个消息 — 例如,使用 或 轮询器。 有关详细信息,请参阅延迟确认可轮询消息源MessageSourcePollingTemplateSpring中文文档

它当前不支持 XML 配置。Spring中文文档

以下示例演示如何配置:AmqpMessageSourceSpring中文文档

@Bean
public IntegrationFlow flow() {
    return IntegrationFlow.from(Amqp.inboundPolledAdapter(connectionFactory(), DSL_QUEUE),
                    e -> e.poller(Pollers.fixedDelay(1_000)).autoStartup(false))
            .handle(p -> {
                ...
            })
            .get();
}
@Bean
public AmqpMessageSource source(ConnectionFactory connectionFactory) {
    return new AmqpMessageSource(connectionFactory, "someQueue");
}

有关配置属性,请参阅 JavadocSpring中文文档

XML格式
This adapter currently does not have XML configuration support.

批处理消息

对于轮询适配器,没有侦听器容器,批处理消息始终是经过批处理的(如果支持这样做)。BatchingStrategySpring中文文档