[rabbitmq-discuss] RabbitMQ/AMQP understanding

Ben Hood 0x6e6562 at gmail.com
Fri Aug 22 15:25:51 BST 2008


Torben,

On Fri, Aug 22, 2008 at 2:31 PM, Torben Hoffmann
<torben.lehoff at googlemail.com> wrote:

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

MOM = Message-oriented middleware

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

As indicated in my previous mail, one way this can be achieved is
using a fanout exchange.

[Taken from the spec] The fanout exchange type works as follows:

1. A message queue binds to the exchange with no arguments.
2. A publisher sends the exchange a message.
3. The message is passed to the message queue unconditionally.

Here is a simple example using the Ruby client for AMQP:

http://github.com/tmm1/amqp/tree/master/examples/mq/clock.rb

Although this is a Ruby example, the basic principle of a creating a
queue, binding it to an exchange and subscribing a consumer to it hold
true of any client language. I just used this as an example because it
is a quick link.

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

This is achieved using OTP distribution mechanisms with some
AMQP/Rabbit-specific optimizations between nodes.

In *very* loose terms, a client opens a channel on a particular node
and this broker-side channel creates a communication link between
itself and the underlying queue *instance*, wherever that may
physically reside. If it declares a queue that doesn't already exist,
the queue will be created locally, if it already exists it *may*
already reside on another node, but OTP message passing keeps this
transparent.

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

G would be the name an exchange and B & C create queues and bind them
to the exchange G.

As indicated above this could be a simple fanout, but a direct
exchange with multiple bindings would work as well.

Note that you do not necessarily need an AMQP instance on machine that
clients run on. Multiple remote clients can connect to a single broker
instance.

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

When you say you have hundreds of machines, do you mean machines that
you will use to run consumer processes on?

The size of your broker cluster will depend (amongst other factors) on
the amount of messages you need the system to be able to handle.

HTH,

Ben




More information about the rabbitmq-discuss mailing list