【问题标题】:Spring integration error:- org.springframework.messaging.MessageDeliveryException: Dispatcher has no subscribers for channel while connecting to MQSpring 集成错误:- org.springframework.messaging.MessageDeliveryException:Dispatcher 在连接到 MQ 时没有频道订阅者
【发布时间】:2019-01-28 22:57:23
【问题描述】:

我正在尝试使用 Spring 集成连接到 JMS 客户端,但我得到了:-

[WARN] 2018-08-22 10:57:20.378 [DispatchThread: [com.ibm.mq.jmqi.remote.impl.RemoteSession[connectionId=414D514353414D5030303144202020206CF77A5B9E4A5E21]] SimpleMessageListenerContainer - J没有设置 ErrorHandler。 org.springframework.messaging.MessageDeliveryException: Dispatcher 没有频道“app-name:local:9010.inputChannel”的订阅者。嵌套异常是 org.springframework.integration.MessageDispatchingException: Dispatcher 没有订阅者,failedMessage=GenericMessage

下面是我的spring集成配置类

知道为什么我会收到此异常。

提前非常感谢

【问题讨论】:

    标签: spring-boot jms spring-integration message-queue spring-jms


    【解决方案1】:

    问题正是消息所说的。

    Dispatcher 没有频道“app-name:local:9010.inputChannel”的订阅者。

    你在这个 bean 上没有订阅者

    @Bean
    public MessageChannel inputChannel() {
        return new DirectChannel();
    }
    

    编辑

    @ServiceActivator(inputChannel = "inputChannel")
    public void handle(String in) {
        ...
    }
    

    @Transformer(inputChannel = "inputChannel", outputChannel = "transformed")
    public String handle(String in) {
        retur in.toUpperCase();
    }
    
    @ServiceActivator(inputChannel = "transformed")
    public void handle(String in) {
        ...
    }
    

    【讨论】:

    • 你了解 Spring 集成吗?这取决于您想对消息执行什么操作。通常,您将有一个@ServiceActivator POJO 方法来处理消息。
    • 我在答案中添加了一个示例;见the reference manual
    猜你喜欢
    • 2019-10-04
    • 2015-11-02
    • 2017-05-05
    • 2021-01-31
    • 1970-01-01
    • 2018-09-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多