首页 > 解决方案 > 如何动态停止消息驱动的适配器以停止接收消息?

问题描述

   <control-bus input-channel ="inboundChannel/>
    <channel id ="inboundChannel"/>
    <message-driven-channel-adapter id="inAQueue" channel="inboundChannel" 
    auto-startup="false" container="DefaultContainer"/>
    <service-activator input-channel="inboundChannel" ref="Something" 
    method="abc"/>

inboundChannel.send(MessageBuilder.withPayload("@inAQueue.stop()").build();

inboundChannel.send(MessageBuilder.withPayload("@inAQueue.start()").build());

But my service activator class receive this message and throws class cast exception that string can not be cast to jmstextMessage.

而且我不确定我是否以正确的方式尝试它。

标签: jmsspring-integration

解决方案


您有 2 个订阅者inboundChannel- 消息驱动的适配器和控制总线。消息将以循环方式分发。

控制总线应该订阅它自己的通道,控制消息被发送到该通道。


推荐阅读