ActiveMQ - 向特定消费者发送消息 [英] ActiveMQ - sending message to specific consumer

查看:36
本文介绍了ActiveMQ - 向特定消费者发送消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

连接了单个 AMQ 代理和 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).

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

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?

推荐答案

你可以使用 JMS selectors.

You could use JMS selectors.

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

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

这篇关于ActiveMQ - 向特定消费者发送消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆