tkachuko
tkachuko

Reputation: 1986

Spring integration: receive messages from multiple JMS destinations

I am using java DSL to configure my channel adapters. The thing I want to achieve can be described with the following piece of code:

IntegrationFlows
                .from(Jms.messageDriverChannelAdapter(mqCacheConnectionFactory)
                        .configureListenerContainer(container -> container.sessionTransacted(transacted))
                        .destinations(inputDestination1, inputDestination2) // missing method
                        .autoStartup(autoStartup)
                        .id(channelName)
                        .errorChannel(errorChannel)
                )
                .channel(commonChannel)
                .get();

So I would like to have messageDriverChannelAdapter that would be capable of receiving from multiple JMS destinations. Is it achievable?

Upvotes: 1

Views: 247

Answers (1)

Artem Bilan
Artem Bilan

Reputation: 121560

No, it isn't possible.

The Spring Integration JMS support is fully based on the Spring JMS foundation. And its AbstractMessageListenerContainer provides ability to consume only one destination. Therefore Jms.messageDriverChannelAdapter() doesn't provide an option to configure several destinations to listen to.

Only option you have is configure several Jms.messageDriverChannelAdapter()s. What is good with Spring Integration that you can output them all to the same MessageChannel and you won't have so much copy/paste hell.

Upvotes: 2

Related Questions