<div dir="ltr">Here, after catching the exception I want send it back to the producer, so that my client will know what kind of error occurred at backend system. As mentioned above if exception occurred inside the handleMessag method message will not deleted from the queue, that is fine and to printing that error message by registering ErrorHandler with the listener container. But, I want to send that exception to the producer, can you please tell me how can we send it back to producer?<div>
<br></div><div>Error handling at consumer end -</div><div><br></div><div><div>@Override</div><div>public void handleError(Throwable t) {</div><div><span class="" style="white-space:pre"> </span>t.printStackTrace();</div><div>
}<br></div></div><div><br></div><div><br></div><div>Thanks in advance.</div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Jan 9, 2014 at 10:50 AM, Rajasekhar P <span dir="ltr"><<a href="mailto:sekhar434145@gmail.com" target="_blank">sekhar434145@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Am using <span style="font-family:arial,sans-serif;font-size:12.727272033691406px">ackMode=AUTO and if any exception occurs in handleMessage() method message will be deleted from the queue, it requeued as you mentioned in the above mail.</span><div>
<span style="font-family:arial,sans-serif;font-size:12.727272033691406px"><br></span></div><div>Thank you for your support.<span style="font-family:arial,sans-serif;font-size:12.727272033691406px"><br></span></div></div>
<div class="HOEnZb"><div class="h5"><div class="gmail_extra">
<br><br><div class="gmail_quote">On Wed, Jan 8, 2014 at 7:29 PM, Gary Russell <span dir="ltr"><<a href="mailto:grussell@gopivotal.com" target="_blank">grussell@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 dir="ltr">However, if you use ackMode=AUTO, the container will take care of your needs - if you throw an exception, the default behavior is to reject (and requeue). If you don't throw an exception, the message will be ack'd.</div>
<div><div>
<div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Jan 8, 2014 at 8:57 AM, Gary Russell <span dir="ltr"><<a href="mailto:grussell@gopivotal.com" target="_blank">grussell@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 dir="ltr"><font face="courier new, monospace">><span style="font-size:13px">public void handleMessage(String message) {</span></font><div style="font-size:13px">
<font face="courier new, monospace">></font></div>
<div style="font-size:13px"><font face="courier new, monospace">>}</font></div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-size:13px"><span style="font-family:arial,sans-serif">This is a </span><font face="courier new, monospace">MessageListener</font><font face="arial, sans-serif"> and doesn't have access to the </font><font face="courier new, monospace">Channel</font><font face="arial, sans-serif">.</font></div>
<div>
<div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">>>Section 3.11 in [1] suggests you are supposed to use Channel#basicAck from RabbitMQ Java client directly.</div>
<div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px"><br></div></div><div style="font-size:13px"><span style="font-family:arial,sans-serif">Right, and to do that, you have to use a </span><font face="courier new, monospace">ChannelAwareMessageListener</font><font face="arial, sans-serif"> that has a different signature...</font></div>
<div style="font-family:arial,sans-serif;font-size:13px"><br></div><div><font face="courier new, monospace">void onMessage(Message message, Channel channel) throws Exception;<br></font></div><div><font face="arial, sans-serif"><br>
</font></div><div><font face="arial, sans-serif"><br></font></div><div style="font-family:arial,sans-serif;font-size:13px"><br></div></div><div><div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Wed, Jan 8, 2014 at 6:25 AM, 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>On 8 Jan 2014, at 14:41, Rajasekhar P <<a href="mailto:sekhar434145@gmail.com" target="_blank">sekhar434145@gmail.com</a>> wrote:<br>
<br>
> I want to handle acknowledgements manually, because, if any error occurs while processing message it should not be deleted from the queue. For this I have used AcknowledgeMode.MANUAL , but am not getting how to set the acknowledgement after processing the message in handleMessage method. Can anyone tell me how to do that?<br>
<br>
</div>Section 3.11 in [1] suggests you are supposed to use Channel#basicAck from RabbitMQ Java client<br>
directly.<br>
<br>
1. <a href="http://docs.spring.io/spring-amqp/docs/1.2.1.BUILD-SNAPSHOT/reference/html/amqp.html#d4e329" target="_blank">http://docs.spring.io/spring-amqp/docs/1.2.1.BUILD-SNAPSHOT/reference/html/amqp.html#d4e329</a><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" target="_blank">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>
</div></div></blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
rabbitmq-discuss mailing list<br>
<a href="mailto:rabbitmq-discuss@lists.rabbitmq.com" target="_blank">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>
<br></blockquote></div><br></div>
</div></div></blockquote></div><br></div>