[rabbitmq-discuss] Spying on "mandatory" messages

Matthew Sackman matthew at rabbitmq.com
Thu Mar 24 15:05:17 GMT 2011

Hi Charly,

On Thu, Mar 24, 2011 at 03:35:35PM +0100, Charly Hamy wrote:
> For the req/res scenario, I'm using the mandatory flag on my messages, so
> that sending a request message to a disconnected component (no corresponding
> queue declared on the broker) returns an error to the sender. This works as
> expected.

Well... you're using mandatory as a poor-man's form of resource

> But now, I would want to plug new components to spy on those flows of
> requests and responses, without interfering with the ongoing
> communications... which is not by default compatible with my use of the
> mandatory flag : when a "spy" component is monitorng request/response
> messages, those messages end-up in its queue, then even if the actual target
> component for those messages is not present on the broker (no queue), no
> error is returned to the sender.

Indeed, which is why mandatory is probably a mis-feature and should not
be used. Basically, AMQP does not really provide any sort of sane
resource monitoring. We've added in the 2.4.0 release consumer-death
notifications, but that's not going to help you here. You really have a
choice: make the queue non-exclusive and non-autodelete. Thus it always
stays there and will always receive messages. Then, you have your
clients just consume from it. The queue will do round-robining between
the consumers and all should be well, but you might have reasons why you
want the queue to be exclusive or autodelete. The other option is to use
some other tool to do monitoring of your consumers and to address that
problem outside of AMQP/RabbitMQ.

Best wishes,


More information about the rabbitmq-discuss mailing list