[rabbitmq-discuss] publish mandatory/immediate flags
matthias at lshift.net
Fri Nov 9 11:09:19 GMT 2007
> I have a question regarding the mandatory and
> immediate flags. One of the basic publish options is as follows:
> session.getExchange(), key, basicProps, data);
> This has mandatory/immediate set to false. Could it be that the new
> server load is causing requests to get dropped at times? What are the
> drawbacks to changing those values to true by using the other call?
With 'mandatory' set to true you will get an asynchronous notification
when a message cannot be routed to any queue, e.g. because there are no
queues bound to the exchange, or the routing key matching fails to
produce a result.
With 'immediate' set to true you will get an asynchronous notification
when a message cannot be sent to a consumer straight away, i.e. if it
would be queued. This can happen there are no consumers registered on a
queue or they are all overloaded.
In the Java client, the notifications are received by the ReturnListener
set with channel.setReturnListener(listener).
The drawback of setting these flags is an increase in latency and drop
in throughput, though not by all that much.
More information about the rabbitmq-discuss