jms - 如何动态停止消息驱动的适配器以停止接收消息?
问题描述
<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.
而且我不确定我是否以正确的方式尝试它。
解决方案
您有 2 个订阅者inboundChannel
- 消息驱动的适配器和控制总线。消息将以循环方式分发。
控制总线应该订阅它自己的通道,控制消息被发送到该通道。
推荐阅读
- c++ - 直接传递编译选项(绕过 CMakeLists.txt)
- java - 从包含 java 源文件的 jar 创建包含 .class 文件的 jar 文件的最快方法?
- mysql - 当我使用子字符串时,起点是 1,而不是零 (0)
- javascript - 想要使用 getCurrentPosition() 或类似方法获取设备 GPS 位置并将结果返回到 PHP
- reactjs - RxJS - 从组件构造函数调度一个动作
- cors - 请求的默认请求模式实际上是“no-cors”,还是“cors”?
- tensorflow - 如何将 Tensorflow Keras 检查点保存到 pb 文件
- python - 如何从 python 中的 JSON 中获取一个键和值?
- git - 拉取请求数量高于我的回购预期?
- python - 使用 Pandas 沿文本文件行的描述性统计