ActiveMQ - 向特定消费者发送消息

发布于 2024-08-26 01:11:22 字数 175 浏览 5 评论 0原文

连接单个 AMQ 代理和 100 个消费者。我会将消息发送给某个特定的消费者,这样其他消费者就不会收到它(客户端过滤不起作用)。

最简单的方法是创建虚拟目的地(将其命名为queue:consumer-)并在那里发送消息。然而,这将导致 100 个新队列,这使得监控变得更加复杂。有没有其他方法可以用单个队列来做到这一点?

Having single AMQ broker and 100 consumers connected. I would send the message to some specific consumer, so other consumers does not receive it (client-side filtering won't work).

Simplest way is to create virtual destinations (name them queue:consumer-) for example and send messages there. However this will lead to 100 new queues which makes it more complex to monitor. Is there any other way to do this having single queue?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

谎言月老 2024-09-02 01:11:22

您可以使用 JMS 选择器

您将为每个消费者指定一个唯一的 ID,生产者必须知道这些 ID 才能仅发送给特定的消费者。消费者必须协作,并设置一个选择器以仅接收指定给其自己的 id 的消息以及指定给所有/任何消费者的消息

You could use JMS selectors.

You would designate a unique id to each of your consumers, the producer would have to know about those ids to send only to a specific consumer. The consumers have to collaborate, and set a selector to receive only messages designated to its own id as well messages designated to all/any of the consumers

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文