Spring Integration的事件监听站适配器

问题描述 投票:0回答:1

我有一个问题,我想实现使用DSL春季集成的输入适配器,作为一个事件监听器,并重定向从该事件侦听器消息的通道。

所需的代码:

@Bean
public IntegrationFlow listenerFlow() {
    return IntegrationFlows.from(InputAdapterListener.listen())
            .channel("ChannelXYZ")
            .get();
}

可有人向我解释,这将是InputAdatperListener类的实现来支持这样的行为,或者寻找一些例子吗?

java spring spring-integration event-listener spring-integration-dsl
1个回答
1
投票

有一个在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。

© www.soinside.com 2019 - 2024. All rights reserved.