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

Spring integration Spring集成JavaDSL:创建jms消息驱动程序通道适配器,spring-integration,Spring Integration,以下消息驱动程序通道适配器有问题 @Bean public IntegrationFlow jmsInboundFlow() { return IntegrationFlows.from(Jms.messageDriverChannelAdapter(this.jmsConnectionFactory) .outputChannel(MessageChannels.queue("inbound").get())

以下消息驱动程序通道适配器有问题

@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();
    }

我收到一个关于“Dispatcher没有频道的订户”的错误。将消息负载发送到另一个集成流的首选配置是什么?

使用Java DSL
频道自动创建时,您应该小心。例如,
.outputChannel(MessageChannels.queue(“inbound”).get())
不会将
MessageChannel
bean填充到bean工厂。但从另一个方面来看,集成是流动的。从(“入站”)
就是这样做的

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

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

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

您的
@Configuration
类中是否定义了
@enableigration
?我确实定义了@enableigration。这是我以前对.channel的定义。然后我注意到了.outputChannel的配置,这就是我切换的原因。所以,这是不同的困惑。当你说仅仅依靠DSL,我不确定我是否理解。例如,我如何连接错误通道?一个
错误通道
表示一个单独的消息流,因此它应该基于真实的
消息通道
@Bean