Spring集成Java DSL:创建jms消息驱动程序通道适配器

zac*_*ung 4 spring-integration

我遇到以下消息驱动程序通道适配器的问题

@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();
    }
Run Code Online (Sandbox Code Playgroud)

我收到一个关于"Dispatcher没有订阅者频道"的错误.将消息有效负载发送到另一个集成流的首选配置是什么?

Art*_*lan 5

使用Java DSL channel auto-creation你应该小心.例如,.outputChannel(MessageChannels.queue("inbound").get())不会将MessageChannelbean 填充到bean工厂.但是从另一方面IntegrationFlows.from("inbound")做到了.

要解决您的问题,我建议@Bean您为您的inbound频道提取,或者只是依靠DSL:

return IntegrationFlows.from(Jms.messageDriverChannelAdapter(this.jmsConnectionFactory)
            .destination("test"))
            .channel(MessageChannels.queue("inbound").get())   
            .get();
Run Code Online (Sandbox Code Playgroud)

随意提出一个GH问题来修复JavaDocs .outputChannel()或将其全部删除,因为它很混乱.