[rabbitmq-discuss] RabbitMQ/AMQP understanding

Torben Hoffmann torben.lehoff at googlemail.com
Fri Aug 22 14:31:11 BST 2008

On Fri, Aug 22, 2008 at 3:05 PM, Ben Hood <0x6e6562 at gmail.com> wrote:

> Torben,
> On Fri, Aug 22, 2008 at 1:57 PM, Torben Hoffmann
> <torben.lehoff at googlemail.com> wrote:
> > Here is the basic problem I need to solve - see attached picture:
> > A, B and C are all members of the same group G and when they send
> messages
> > to each other in the group the group ID is used as the target address in
> the
> > message.
> >
> > (In case the attached picture does not arrive: A is located at machine
> M1, B
> > @ M2 and C @ M3.)
> >
> > So when A sends Msg to the group G it has to be routed to B and C where
> ever
> > they may be. As you can see A sends Msg to M1 which notices that it is
> > targeted to the group G and M1 then finds out that there are group
> members
> > of G at the machines M2 and M3, hence it sends Msg to M2 and M3. At the
> > receiving machines - M2 and M3 - the message is then delivered to the
> > members of the group attached to the machine.
> This *sounds* like a simple fanout exchange scenario. Fanout exchanges
> are one of the basic exchange types in AMQP. It could also be achieved
> using other exchange types, depending on what the specific
> requirements are.
> >
> > The naïve approach would be to create a queue for the group G and have
> all
> > group members subscribe to that queue.
> > Questions:
> >
> >    1. Does the sender receives its own message though the queue?
> Not quite sure what you mean with this. Are you asking whether a
> producer gets an echo of each message it sends by default? In general
> nobody will receive a message unless it is consuming from a queue that
> messages are routed to.

Alexis added the last bit of explanation so now I know that I can send to a
queue where I am a consumer without getting my own messages.

> >    2. Is there a way to notify clients like B and C that there is a
> message
> > for them in one of their queues? Or do you have to poll the queue to find
> > out if there is something for you? (Basically this is a question of using
> a
> > interrupt like thing vs polling.)
> If a client subscribes to a queue, the channel will deliver messages
> to it as and when they are routed, so there is no need to poll
> explicitly. If for some reason you need to poll, there is a method
> called basic.get which allows you to poll a queue.

This is brilliant - for sanity I would really like to avoid polling the
queue since the non-polling setup makes my architecture a lot nicer.

> BTW, are you asking this question in the context of the API of a MOM
> system that you have used in the past?

Not sure what a MOM system is, but I am trying to map the functionality of a
legacy system to AMQP since I think it could save a lot of effort and money.

> >
> > Now for the deployment: I cannot use a single AMQP server to handle all
> of
> > this since the load would be too high to meet the strict performance
> > requirements in place so some sort of distribution of the work must be
> done.
> >
> > My initial understanding leads me to say that for the attached problem I
> > should create a cluster consisting of M1, M2 and M3 and then just let
> > RabbitMQ deal with all the nitty gritty details.
> You can set up a cluster of Rabbit broker instances. This is explained
> in more detail in the clustering guide:
> http://www.rabbitmq.com/clustering.html
> > Is that a correct understanding of how to use RabbitMQ to address the
> basic
> > problem?
> Without wanting to assume anything from the attachment, the impression
> arises that you are thinking of an MQ-Series topology with
> transmission queues.
> You don't necessarily need to do that with AMQP. You could treat a
> broker or cluster of brokers as a single logical instance that clients
> connect to in order to subscribe to queues.

For my basic problem I would like to have a queue for the group G that I can
send to and then all members of the queue (bar the sender) will receive that
It does not matter if I have one or more logical instances, but from a
architectural perspective I think that it would be best to have a single
logical instance so that I could utilise the distribution mechanisms of
RabbitMQ without knowing about the topology at the application level.

If I have more than one server how would the messages be distributed?
If I have a AMQP server at each of my machines and user A sends a message to
the group G how would that message be routed to  B and C? How should the
servers be connected/configured to allow that routing?

Note that I could have hundreds of machines but I will send the message to
the few of them that has a member of the group registered at the machine.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20080822/985e2c74/attachment.htm 

More information about the rabbitmq-discuss mailing list