[rabbitmq-discuss] How to determine if my message was publish successfully

Michael Klishin mklishin at gopivotal.com
Wed Oct 30 22:22:46 GMT 2013


On 31 Oct 2013, at 01:56, cistron <cwstorm at gmail.com> wrote:

> Can you recommend a better approach so that when I publish a message I want confirmation from rabbit that it was either successful or not.  What I want is a flag of some sort from rabbit that one of the input parameters is invalid such as the routing key.

Use publisher confirms.

There are many reasons why publishing may fail. Publisher confirms cover most of them
and Channel#waitForConfirms returns a boolean to indicate success or failure for the messages
that were not confirmed by the time it was invoked.

As it was mentioned earlier, basic.return listeners is how you detect unroutable messages.

The only other “input” that can be invalid is exchange name. It will result in a channel exception.
In practice, those are very rare and indicate a misconfiguration. You can check if the exchange
you need exist on application start by using exchangeDeclare with passive set to true.


MK

Software Engineer, Pivotal/RabbitMQ




More information about the rabbitmq-discuss mailing list