【问题标题】:Spring integration Java DSL : creating jms Message Driver Channel AdapterSpring集成Java DSL:创建jms消息驱动通道适配器
【发布时间】:2015-05-26 20:23:33
【问题描述】:

我在使用以下消息驱动程序通道适配器时遇到问题

@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 没有频道订阅者”的错误消息。将消息负载发送到另一个集成流的首选配置是什么?

【问题讨论】:

  • 你的@EnableIntegration 定义在你的@Configuration 类之一上吗?
  • 我确实定义了@EnableIntegration。

标签: spring-integration


【解决方案1】:

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

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

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

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

【讨论】:

  • 这是我以前使用 .channel 时所拥有的。然后我注意到了 .outputChannel 配置,所以这就是我切换的原因。所以它是不同的混乱。
  • 当你说只依赖 DSL 我不确定我是否理解。例如,如何连接错误通道?
  • 一个error-channel代表一个单独的消息流,所以应该基于真实的MessageChannel@Bean
猜你喜欢
  • 2014-01-23
  • 2017-09-18
  • 1970-01-01
  • 1970-01-01
  • 2011-04-29
  • 1970-01-01
  • 2018-08-24
  • 2016-03-25
  • 1970-01-01
相关资源
最近更新 更多