Pollers
Spring Integration 还提供了一个流畅的 API,允许您为 AbstractPollingEndpoint
实现配置 PollerMetadata
。您可以使用 Pollers
构建器工厂配置通用 bean 定义或通过 IntegrationFlowBuilder
EIP 方法创建的定义,如下例所示
@Bean(name = PollerMetadata.DEFAULT_POLLER)
public PollerSpec poller() {
return Pollers.fixedRate(500)
.errorChannel("myErrors");
}
更多信息请参阅 Javadoc 中的 Pollers
和 PollerSpec
。
如果您使用 DSL 将 PollerSpec 构建为 @Bean ,请勿在 bean 定义中调用 getObject() 方法。PollerSpec 是一个 FactoryBean ,它根据规范生成 PollerMetadata 对象并初始化其所有属性。 |