[rabbitmq-discuss] How to handle AcknowledgeMode.MANUAL acknowledgements within handleMessage() method at consumer end?

Rajasekhar P sekhar434145 at gmail.com
Thu Jan 9 05:20:34 GMT 2014


Am using 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.

Thank you for your support.


On Wed, Jan 8, 2014 at 7:29 PM, Gary Russell <grussell at gopivotal.com> wrote:

> 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.
>
>
> On Wed, Jan 8, 2014 at 8:57 AM, Gary Russell <grussell at gopivotal.com>wrote:
>
>> >public void handleMessage(String message) {
>> >
>> >}
>>
>> This is a MessageListener and doesn't have access to the Channel.
>>
>>
>> >>Section 3.11 in [1] suggests you are supposed to use Channel#basicAck
>> from RabbitMQ Java client directly.
>>
>>
>> Right, and to do that, you have to use a ChannelAwareMessageListenerthat has a different signature...
>>
>> void onMessage(Message message, Channel channel) throws Exception;
>>
>>
>>
>>
>>
>> On Wed, Jan 8, 2014 at 6:25 AM, Michael Klishin <mklishin at gopivotal.com>wrote:
>>
>>> On 8 Jan 2014, at 14:41, Rajasekhar P <sekhar434145 at gmail.com> wrote:
>>>
>>> > 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?
>>>
>>> Section 3.11 in [1] suggests you are supposed to use Channel#basicAck
>>> from RabbitMQ Java client
>>> directly.
>>>
>>> 1.
>>> http://docs.spring.io/spring-amqp/docs/1.2.1.BUILD-SNAPSHOT/reference/html/amqp.html#d4e329
>>>
>>> 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
>>>
>>
>>
>
> _______________________________________________
> 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/20140109/c9f8e660/attachment.html>


More information about the rabbitmq-discuss mailing list