即使我的端点被声明为 Bridge,消息也没有进入通道

Message is not coming into channel even my endpoint is declared as Bridge

在我的应用程序中,我有服务激活器,它在输入通道中获取消息,在激活器方法中进行一些处理,然后将处理后的消息放回 output-channel 以保存使用 mongo-适配器的数据库。

我已经声明了 output-channel like <int-channel id="outputchannel"/>

在我的 junit 测试中测试 outputchannel 中的消息,我使用如下。

<bridge input-channel="outputchannel" output-channel="testInputChannel">

testInputChannel 声明为 QueueChannel

消息还在mongo-adapter input-channel="outputchannel".

我是否需要明确声明输出通道为 pub-sub 通道。不然不会到testInputChannel

有两个订阅者,消息将以循环方式发送到 mongo 适配器和网桥。

要进行测试,您可以让测试用 pub/sub 替换频道。

stop() mongo适配器;这通常更适合测试用例。

您可以使用 auto-startup="${should.start}" 并使用 属性 不在测试用例中启动适配器,而是在生产环境中启动它。

mongo 适配器在 start() 编辑之前不会订阅该频道。

或者,如果您的测试只发送一条消息,请确保桥接器是该通道的第一个订阅者。