1
我有一个通过JDBC读取数据的JdbcPollingChannelAdapter。我想让它手动轮询(使用commandChannel)。它不应该自动轮询,并且它应该在我触发手动轮询时立即运行。JdbcPollingChannelAdapter:只手动轮询数据库
下面我使用了一个轮询器,它每24小时运行一次以获得运行的频道。因为Pollers.cronExpression()不需要年份,所以我不能使用不会像Quartz: Cron expression that will never execute那样激发的cronExpression。
@Bean
public MessageSource<Object> jdbcMessageSource() {
return new JdbcPollingChannelAdapter(this.dataSource, "SELECT...");
}
@Bean
public IntegrationFlow jdbcFlow() {
return IntegrationFlows
.from(jdbcMessageSource(),
spec -> spec.poller(
Pollers.fixedRate(24, TimeUnit.HOURS)))
.handle(System.out::println)
.get();
}