1
我试图在春季的一个程序,它进行数据库轮询并选择该记录读取。我看到xml的例子,但我想知道我们在java配置中如何做。有人能给我看一个例子吗?春季Jdbc入站通道适配器
我试图在春季的一个程序,它进行数据库轮询并选择该记录读取。我看到xml的例子,但我想知道我们在java配置中如何做。有人能给我看一个例子吗?春季Jdbc入站通道适配器
你需要JdbcPollingChannelAdapter
@Bean
定义,标有@InboundChannelAdapter
:
@Bean
@InboundChannelAdapter(value = "fooChannel", poller = @Poller(fixedDelay="5000"))
public MessageSource<?> storedProc(DataSource dataSource) {
return new JdbcPollingChannelAdapter(dataSource, "SELECT * FROM foo where status = 0");
}
Ok..but怎么去处理该记录 – sash84
'@ ServiceActivator'是有你消耗从消息'fooChannel':http://docs.spring.io/spring-integration/docs/4.3.11.RELEASE/reference/html/configuration.html#annotations –
嗨,你能解释一下服务执行器的方法,用于使用jdbc记录吗? – sash84