如何动态停止消息驱动适配器以停止接收消息?

时间:2019-06-04 08:24:16

标签: jms spring-integration

   <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.

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

1 个答案:

答案 0 :(得分:0)

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

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