我有一个问题,我想使用 dsl 在 spring 集成中实现一个输入适配器,作为事件侦听器并将消息从该事件侦听器重定向到通道。
所需代码:
@Bean
public IntegrationFlow listenerFlow() {
return IntegrationFlows.from(InputAdapterListener.listen())
.channel("ChannelXYZ")
.get();
}
有人可以向我解释什么是 InputAdatperListener 类的实现来支持这样的行为,或者在哪里寻找一些例子?
有一个ApplicationEventListeningMessageProducer
在spring-integration-event
为您在使用from()
配置:
private ApplicationListener<?> applicationListener() {
ApplicationEventListeningMessageProducer producer = new ApplicationEventListeningMessageProducer();
producer.setEventTypes(TestApplicationEvent1.class);
producer.setOutputChannel(resultsChannel());
return producer;
}
...
IntegrationFlows.from(applicationListener())
这个会自动注册为一个bean。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句