<div dir="ltr">MK,<div><br></div><div>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.</div>
<div><br></div><div>channel.basicPublish(strExchangeName, strRoutingKey, true, MessageProperties.PERSISTENT_TEXT_PLAIN, byteMessage);<br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Oct 30, 2013 at 4:02 PM, Michael Klishin <span dir="ltr"><<a href="mailto:mklishin@gopivotal.com" target="_blank">mklishin@gopivotal.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im"><br>
On 30 Oct 2013, at 23:56, cw storm <<a href="mailto:cwstorm@gmail.com">cwstorm@gmail.com</a>> wrote:<br>
<br>
> I'm using the java client libraries from RabbitMQ. Just wondering if it's possible to determine if a message was publish to the queue successfully or not after invoking basicPublish. If so, can you please share example code how this is accomplish?<br>
<br>
</div><a href="http://www.rabbitmq.com/confirms.html" target="_blank">http://www.rabbitmq.com/confirms.html</a><br>
<a href="http://hg.rabbitmq.com/rabbitmq-java-client/file/default/test/src/com/rabbitmq/examples/ConfirmDontLoseMessages.java" target="_blank">http://hg.rabbitmq.com/rabbitmq-java-client/file/default/test/src/com/rabbitmq/examples/ConfirmDontLoseMessages.java</a><br>
<br>
(TL;DR: com.rabbitmq.client.Channel#waitForConfirms)<br>
<br>
Note that<br>
<br>
1. You want confirm batches (of 16, 32, 64 messages) if possible<br>
2. Even with batch confirmation, Publisher Confirms have significant impact on publishing throughput<br>
<br>
MK<br>
<br>
Software Engineer, Pivotal/RabbitMQ<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
_______________________________________________<br>
rabbitmq-discuss mailing list<br>
<a href="mailto:rabbitmq-discuss@lists.rabbitmq.com">rabbitmq-discuss@lists.rabbitmq.com</a><br>
<a href="https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss" target="_blank">https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss</a><br>
</div></div></blockquote></div><br></div>