我是 Spring 集成和消息传递通道的新手,请您帮助我处理 JDBC Spring 集成消息传递通道。
我创建了 3 个应用程序 Poller 、 Executor 和出站通道,但我很困惑这 3 个应用程序将如何通信和发送消息。
如何使用 .xml 从 xml 下方配置请求通道和回复通道IngrationFlow
。
<int-jdbc:outbound-gateway
update="insert into mythings (id, status, name) values (:headers[id], 0, :payload[thing])"
request-channel="input" reply-channel="output" data-source="dataSource" />
我的代码 -
@Bean
public MessageSource<Object> jdbcMessageSource() {
JdbcPollingChannelAdapter jdbcPollingAdapter = new JdbcPollingChannelAdapter(jdbcTeamplate,
"select UUID,reference_id,STATUS, from PURGE_SOURCE_GADB where STATUS='P'");
jdbcPollingAdapter.setUpdateSql(
"insert into PURGE_EXECUTOR_GADB select uuid,reference_id,DELIVERY_STATUS from PURGE_SOURCE_GADB where reference_id in (reference_id)");
jdbcPollingAdapter.setMaxRows(2);
jdbcPollingAdapter.setRowMapper(new ExecutorTaskRowMapper());
jdbcPollingAdapter.setUpdatePerRow(true);
return jdbcPollingAdapter;
}
@Bean
public IntegrationFlow outboundChannelAdapterFlow(ExecutorTasklet executorTasklet) throws Exception {
System.out.print("AAAA"+executorTasklet.getUUID());
return f->f.handle(executorTasklet,"handle");
}
如何在上面的代码中配置请求通道和回复通道,并将有效负载发送到回复通道。