[rabbitmq-discuss] Clustering Internals

Matthew Sackman matthew at rabbitmq.com
Thu Mar 24 13:59:44 GMT 2011

Hi Jason,

On Wed, Mar 23, 2011 at 10:14:34AM -0600, Jason J. W. Williams wrote:
> So mandatory or not, the channel doesn't release the publisher until it's
> routed the message? So if a node crash were to occur while a message was
> being routed the publisher could assume the message was lost because the the
> publisher would still be waiting to be released when they lost connection?

I seem to be succeeding in making you more confused, not less.

There is one conceptual thing called a "channel". But that conceptual
thing has representation on the client and in the broker. Thus when I
talk about "the channel process", I'm almost always meaning the channel
process on the broker, that handles all actions issued by the client
upon that channel.

It is the channel process that "performs routing": i.e. the
determination of which queue processes a given message should be sent on
to. This action requires no input from any queues at all: it is
currently just a series of database lookups. When the channel has
finished figuring out which queues the message should be sent to, it
just sends the message to those queues.

Now if there are no mandatory/immediate flags set then the publish from
the channel to the queue is entirely fire and forget: there is
absolutely no indication to the channel whether or not the queue still
exists or when it received the msg or when it processed the msg.

If the mandatory or immediate flag is set, then the channel must do a
synchronous call to each queue to which the msg is being sent in order
to find out what happens to the msg and thus return the correct response
(if any) to the client-side channel.

Mandatory is a MAY analysis or a disjunction: i.e. of the set of queues
to which the msg is apparently meant to be sent, provided at least one
of those queues receives the msg (i.e. has not been deleted or otherwise
lost between the act of routing and the act of sending the msg to the
queue), then no error occurs.

Likewise, Immediate indicates that of all the queues to which the msg is
sent, provided one of those queues is able to immediately chuck the msg
out to a consumer, all is well. The additional complexity with immediate
is that of the queues which could not send the msg straight out to a
consumer, the queue does not enqueue the msg. Immediate and mandatory
are both really mis-features of AMQP and should not be used.

> My understanding previously was that when you publish it's fire-and-forget
> while the routing occurs...you're instantly released while the routing is in
> process.

I don't know to what you're referring when you say "you're instantly
released" - _what_ is instantly release?


More information about the rabbitmq-discuss mailing list