Polled Inbound Channel Adapter
Overview
5.0.1 版本引入了轮询通道适配器,让您能够按需获取单独的消息——例如,使用 MessageSourcePollingTemplate
或轮询器。有关更多信息,请参阅 Deferred Acknowledgment Pollable Message Source。
Version 5.0.1 introduced a polled channel adapter, letting you fetch individual messages on demand — for example, with a MessageSourcePollingTemplate
or a poller.
See Deferred Acknowledgment Pollable Message Source for more information.
目前不支持 XML 配置。
It does not currently support XML configuration.
以下示例展示了如何配置 AmqpMessageSource
:
The following example shows how to configure an 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。
See the Javadoc for configuration properties.
This adapter currently does not have XML configuration support.
Batched Messages
参见 Batched Messages。
See Batched Messages.
对于轮询适配器,没有侦听器容器,批量消息始终被解除批处理(如果 BatchingStrategy
支持这样做)。
For the polled adapter, there is no listener container, batched messages are always debatched (if the BatchingStrategy
supports doing so).