[rabbitmq-discuss] Need to deliver same (common) message to all subscribers (multicast)

Bryan Murphy bmurphy1976 at gmail.com
Tue Apr 26 16:53:14 BST 2011

On Tue, Apr 26, 2011 at 1:33 AM, Allan Kamau <kamauallan at gmail.com> wrote:
> I would like to have all my consumers receive a copy of any message in
> a specific queue. This message contain some initialization data for
> the clients.
> Seems I am looking for a multicast example using Java API.
> At the moment I am looking at having the clients call
> Channel.basicCancel() method after receiving and processing the
> message but before that they set their own instance variable to true
> (indicating they have already retrieved and successfully used the
> "shared" message) so as not to request for this message again.
> But I think the above solution may lead to serialized processing of
> the queued message, all the clients waiting on this queue will have to
> wait till the message is made available again to the queue by the
> consumer currently awarded the message.

Your approach is very wrong.  The simplest form of multicast is to
send a message to a fanout exchange and then have each of your
subscribers create a unique queue that is bound to that fanout
exchange.  Each subscriber will then get their own private
(non-shared) copy of each message.

You should read the AMQP spec.  I found it to be far more informative
than reading the API documentation.  Piecing together what to do with
the API was a walk in the park after having read the AMQP spec.


More information about the rabbitmq-discuss mailing list