You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "Reichert, Andre" <an...@here.com> on 2014/04/17 15:30:32 UTC

Camel RabbitMQ acknowledge messages

Hi,

We are using RabbitMQ for messaging huge amount of data. For good performance multi acknowledgment of messages is used. Further we send messages from RabbitMQ via EventManager for processing. After a batch we store results in data base and acknowledge processed messages. 

We would like to use Camel for connection to RabbitMQ but the acknowledgment of messages is hard coded in RabbitMQConsumer. This class has the implementation of com.rabbitmq.client.DefaultConsumer.handleDelivery that does acknowledgment of a message right after calling process method. See code snippet below. Is it possible to have the acknowledgment attached to the Exchange object or have another possibility to acknowledge messages except auto acknowledgement?

Kind regards
Andre Reichert

Code snippet from org.apache.camel.component.rabbitmq.RabbitMQConsumer

123                 consumer.getProcessor().process(exchange);
124 
125                 long deliveryTag = envelope.getDeliveryTag();
126                 if (!consumer.endpoint.isAutoAck()) {
127                     log.trace("Acknowledging receipt [delivery_tag={}]", deliveryTag);
128                     channel.basicAck(deliveryTag, false);
129                 } 




Andre Reichert
Senior Engineer
Map Community Platform
Phone: +49 6196 589 337


50° 9' 43" N. 8° 32' 1" E
HERE, a Nokia business

Place of Business: HERE Germany GmbH & Co. KG, Am Kronberger Hang 8, 65824 Schwalbach, Germany  - Commercial Register: Amtsgericht Frankfurt am Main, HRA 43654; USt-ID-No.: DE 259 126 202; Managing Directors: Hans P.J. Gieszen, Robertus A.J. Houben
CONFIDENTIALITY NOTICE 
This e-mail and any attachments hereto may contain information that is privileged or confidential, and is intended for use only by the individual or entity to which it is addressed. Any disclosure, copying or distribution of the information by anyone else is strictly prohibited. If you have received this document in error, please notify us promptly by responding to this e-mail. Thank you.


Re: Camel RabbitMQ acknowledge messages

Posted by Willem Jiang <wi...@gmail.com>.
Hi,

If you set the option of autoAck is false, Camel will send the acknowledgement to RabbitMQ when the exchange is processed. 

If you want to do it in the batch mode, you may need to change the RabbitMQConsumer, but I’m not sure how can get the channel if you want to send the acknowledgement in your custom bean.

--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On April 17, 2014 at 9:31:03 PM, Reichert, Andre (andre.reichert@here.com) wrote:
> Hi,
>  
> We are using RabbitMQ for messaging huge amount of data. For good performance multi acknowledgment  
> of messages is used. Further we send messages from RabbitMQ via EventManager for processing.  
> After a batch we store results in data base and acknowledge processed messages.
>  
> We would like to use Camel for connection to RabbitMQ but the acknowledgment of messages  
> is hard coded in RabbitMQConsumer. This class has the implementation of com.rabbitmq.client.DefaultConsumer.handleDelivery  
> that does acknowledgment of a message right after calling process method. See code snippet  
> below. Is it possible to have the acknowledgment attached to the Exchange object or have  
> another possibility to acknowledge messages except auto acknowledgement?
>  
> Kind regards
> Andre Reichert
>  
> Code snippet from org.apache.camel.component.rabbitmq.RabbitMQConsumer
>  
> 123 consumer.getProcessor().process(exchange);
> 124
> 125 long deliveryTag = envelope.getDeliveryTag();
> 126 if (!consumer.endpoint.isAutoAck()) {
> 127 log.trace("Acknowledging receipt [delivery_tag={}]", deliveryTag);
> 128 channel.basicAck(deliveryTag, false);
> 129 }
>  
>  
>  
>  
> Andre Reichert
> Senior Engineer
> Map Community Platform
> Phone: +49 6196 589 337
>  
>  
> 50° 9' 43" N. 8° 32' 1" E
> HERE, a Nokia business
>  
> Place of Business: HERE Germany GmbH & Co. KG, Am Kronberger Hang 8, 65824 Schwalbach,  
> Germany - Commercial Register: Amtsgericht Frankfurt am Main, HRA 43654; USt-ID-No.:  
> DE 259 126 202; Managing Directors: Hans P.J. Gieszen, Robertus A.J. Houben
> CONFIDENTIALITY NOTICE
> This e-mail and any attachments hereto may contain information that is privileged or  
> confidential, and is intended for use only by the individual or entity to which it is addressed.  
> Any disclosure, copying or distribution of the information by anyone else is strictly  
> prohibited. If you have received this document in error, please notify us promptly by  
> responding to this e-mail. Thank you.
>  
>