<div dir="ltr">MK,<div><br></div><div>This is my try/catch block code. �When I publish, it will also but success just as long the exchange name is correct. �Even if you provide and invalid routing key, it&#39;ll be success. �It doesn&#39;t goto the catch block.</div>
<div><br></div><div><div>try</div><div>{</div><div><br></div><div><span class="" style="white-space:pre">        </span>ConnectionFactory factory = new ConnectionFactory();</div><div><span class="" style="white-space:pre">        </span>factory.setUri(strFactoryURI);</div>
<div><span class="" style="white-space:pre">        </span>Connection conn = factory.newConnection();</div><div><span class="" style="white-space:pre">        </span>Channel channel = conn.createChannel();</div><div><br></div><div><span class="" style="white-space:pre">        </span>AMQP.BasicProperties.Builder ct = new AMQP.BasicProperties.Builder();</div>
<div><span class="" style="white-space:pre">        </span>AMQP.BasicProperties contentTypeHeader = ct.contentType(strContentType).build();</div><div><br></div><div><span class="" style="white-space:pre">        </span>channel.basicPublish(strExchangeName, strRoutingKey, contentTypeHeader, byteMessage);</div>
<div><br></div><div><span class="" style="white-space:pre">        </span>SuccessPutFlag = &quot;true&quot;;</div><div><br></div><div><span class="" style="white-space:pre">        </span>channel.close();</div><div><span class="" style="white-space:pre">        </span>conn.close();</div>
<div><br></div><div>} catch (Exception e) {</div><div><span class="" style="white-space:pre">        </span>// do something</div><div>}</div><div>finally</div><div><span class="" style="white-space:pre">        </span>{</div><div><span class="" style="white-space:pre">                </span>pipelineCursor.insertAfter(&quot;SuccessPutFlag&quot;, SuccessPutFlag);</div>
<div><span class="" style="white-space:pre">                </span>pipelineCursor.destroy();</div><div><span class="" style="white-space:pre">        </span>}</div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Oct 29, 2013 at 4:47 PM, Michael Klishin <span dir="ltr">&lt;<a href="mailto:mklishin@gopivotal.com" target="_blank">mklishin@gopivotal.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On 29 Oct 2013, at 22:49, cw storm &lt;<a href="mailto:cwstorm@gmail.com">cwstorm@gmail.com</a>&gt; wrote:<br>

<br>
&gt; However, I don&#39;t know how to capture the basic.return in my code to see if it was successful or not. �I was hoping it would goto the catch block but obviously it didn&#39;t.<br>
<br>
</div>This depends on your client library. What client do you use? Can you post your test code?<br>
<br>
MK<br>
<br>
Software Engineer, Pivotal/RabbitMQ<br>
<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>
</blockquote></div><br></div>