这是场景。我有一个遗留系统,有两个部分,A 部分和 B 部分,它们以客户端/服务器的方式相互发送消息。我创建了一个适配器,可以将这些消息转换为另一种格式,以便在新系统中使用。这些消息发布在多个 JMS 主题上。适配器也会监听这些相同的主题。但是,由于两个适配器是相同的并且在旧系统的每个部分上运行,因此我显然将收到与我发送的相同的消息。
除了为每个适配器分配具有唯一 ID 的“消息源”并对其进行过滤之外,是否有一种优雅的方法来过滤与我发出的消息相同的传入消息?
感谢您的帮助!
Here's the scenario. I have a legacy system with two parts, Part A and Part B, that send messages to each other in a sort of client/server fashion. I've created an adapter that translates these messages into another format for use in a new system. The messages are published on multiple JMS topics. The adapters also listen to these same topics. However, because both adapters are identical and running on each Part of the legacy system, I'm obviously going to be receiving the same messages that I'm sending out.
Is there an elegant way to filter incoming messages that are the same messages I sent out, other than assigning a "message source" with a unique ID for each adapter and filtering on that?
Thanks for your help!
发布评论
评论(1)
您需要指定您的订阅者忽略本地消息。可以在以下位置指定:
关键部分是 noLocal,当设置为 true 时,将忽略从同一个 javax.jms.Connection。从订阅者的角度来看,它们并不存在。
You need to specify that your subscribers ignore local messages. This can be specified in:
The key part is the noLocal which when set to true will ignore messages sent from the same javax.jms.Connection. From the subscriber's perspective, they do not exist.