|
如需使用最新稳定版本,请使用 Spring Integration 7.0.4! |
轮询入站通道适配器
概述
版本 5.0.1 引入了轮询通道适配器,允许按需获取单条消息——例如,配合 MessageSourcePollingTemplate 或轮询器使用。
请参阅 延迟确认的可轮询消息源 以获取更多信息。
当前不支持 XML 配置。
以下示例展示了如何配置一个 AmqpMessageSource:
-
Java DSL
-
Java
@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");
}
查看Javadoc以获取配置属性。
XML
This adapter currently does not have XML configuration support.
批处理消息
请参阅 批量消息。
对于轮询适配器,不存在监听器容器,批量消息始终会被解包(如果BatchingStrategy支持此操作)。