Reputation: 999
I've got a question, i want to implement an input adapter in spring integration using dsl, as an event listener and redirect messages from that event listener to a channel.
desired code:
@Bean
public IntegrationFlow listenerFlow() {
return IntegrationFlows.from(InputAdapterListener.listen())
.channel("ChannelXYZ")
.get();
}
can someone explain to me what would be the implementation of the InputAdatperListener class to support a behaviour like this, or where to look for some examples?
Upvotes: 0
Views: 1583
Reputation: 121177
There is an ApplicationEventListeningMessageProducer
in the spring-integration-event
for you to use in that from()
configuration:
private ApplicationListener<?> applicationListener() {
ApplicationEventListeningMessageProducer producer = new ApplicationEventListeningMessageProducer();
producer.setEventTypes(TestApplicationEvent1.class);
producer.setOutputChannel(resultsChannel());
return producer;
}
...
IntegrationFlows.from(applicationListener())
And this one is going to be registered as a bean automatically.
Upvotes: 1