[rabbitmq-discuss] Making sure a message gets to every consumer

Dan Tenenbaum dtenenba at fhcrc.org
Mon Jan 24 23:00:05 GMT 2011


Hi,
Still trying to migrate my head over from JMS concepts to RabbitMQ.

I have a situation that I want to be like this:

App1 sends a message to anyone who is listening to a certain queue.
I want ALL consumers of that queue to get every message sent by App1, I
don't want it dispatched in a round-robin fashion. At the same time, I don't
think I want to use a fanout exchange because I don't want all consumers in
the vhost to get the message, just the ones that are subscribed to by
instances of:

App2
There are several instances of App2.
When App2 gets a message, it does some work and sends progress messages back
to App1. There is presently only one instance of App1 but I might like to
have other consumers in future for the messages that App1 receives.

The problem:
I can't figure out the right combination of exchange types, queues, and
routing keys to get this to work.

It seems that if I use either 'direct' or 'topic' as my exchange type, the
messages that app1 sends are dispatched in a round-robin fashion (that is,
not all listeners get every message).

If I set the exchange type to fanout, then app2 keeps sending the same
message back to app1 over and over. It could be that I have created an
infinite loop of messages back and forth.


Anyway....in JMS headspace I would simply have 2 topics, call them
"fromapp1" and "fromapp2" and subscribe each app to the appropriate topic,
and it would Just Work....maybe I was doing something wrong back then?
Certainly I'm doing something wrong now.

If someone can suggest the pattern I might want to use, that would be great.

Thanks
Dan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20110124/6192e33c/attachment.htm>


More information about the rabbitmq-discuss mailing list