[rabbitmq-discuss] RabbitMQ/AMQP understanding

Ben Hood 0x6e6562 at gmail.com
Fri Aug 22 14:05:40 BST 2008


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.

>    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.

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


>
> 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.

Please let me know if this answers your question.

HTH,

Ben




More information about the rabbitmq-discuss mailing list