zachariahyoung
zachariahyoung

Reputation: 831

Spring integration Java DSL : creating jms Message Driver Channel Adapter

I'm having issues with the following Message Driver Channel Adapter

@Bean
    public IntegrationFlow jmsInboundFlow() {
        return IntegrationFlows.from(Jms.messageDriverChannelAdapter(this.jmsConnectionFactory)
                .outputChannel(MessageChannels.queue("inbound").get())
                .destination("test"))   
                .get();
    }

    @Bean
    public IntegrationFlow channelFlow() {
        return IntegrationFlows.from("inbound")
                .transform("hello "::concat)
                .handle(System.out::println)
                .get();
    }

I'm getting an error about "Dispatcher has no subscribers for channel". What's the preferred configuration for sending the message payload to another integration flow?

Upvotes: 4

Views: 1635

Answers (1)

Artem Bilan
Artem Bilan

Reputation: 121552

With that Java DSL channel auto-creation you should be careful. For example that .outputChannel(MessageChannels.queue("inbound").get()) doesn't populate a MessageChannel bean to the bean factory. But from other side IntegrationFlows.from("inbound") does that.

To fix your issue I suggest to extract @Bean for your inbound channel, or just rely on the DSL:

return IntegrationFlows.from(Jms.messageDriverChannelAdapter(this.jmsConnectionFactory)
            .destination("test"))
            .channel(MessageChannels.queue("inbound").get())   
            .get();

Feel free to raise a GH-issue to fix JavaDocs on that .outputChannel() or remove it alltogether, since it is confused.

Upvotes: 5

Related Questions