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

Gary Russell grussell at gopivotal.com
Wed Jan 8 13:57:45 GMT 2014


>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 ChannelAwareMessageListener that
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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20140108/0649cf63/attachment.html>


More information about the rabbitmq-discuss mailing list