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

cw storm cwstorm at gmail.com
Wed Oct 30 21:01:16 GMT 2013

I've tried that but it appear the block never get executed as I don't see
the "this is an error".


channel.addReturnListener(new ReturnListener()
public void handleReturn(int replyCode,
String replyText,
String exchange,
String routingKey,
AMQP.BasicProperties props,
byte[] msgContent)
throws IOException {
throw new RuntimeException("this is an error");

On Wed, Oct 30, 2013 at 4:51 PM, Michael Klishin <mklishin at gopivotal.com>wrote:

> On 31 Oct 2013, at 00:42, cw storm <cwstorm at gmail.com> wrote:
> > I want to capture the basic.return information (replyCode, replyText) if
> my basisPublish fails.  I've set the channel to confirm.select and set
> mandatory flag to true.  It's my understanding that if an invalid routing
> key is provided, the message wouldn't route anywhere and the message should
> return to the client since it fail to route to a queue.  I just don't
> understand how to implement that in the java code.
> Publishing is asynchronous, so is returning of messages to the client.
> You need to register a handler for returned messages. This can be used in
> combination
> with publisher confirms, as necessary.
> See http://www.rabbitmq.com/api-guide.html, “Handling unroutable
> messages”.
> MK
> Software Engineer, Pivotal/RabbitMQ
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20131030/1bce8f91/attachment.htm>

More information about the rabbitmq-discuss mailing list