camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrea Cosentino (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CAMEL-9505) RabbitMQConsumer don't use Camel ExceptionHandler BEFORE requeing message
Date Wed, 13 Jan 2016 14:26:39 GMT

    [ https://issues.apache.org/jira/browse/CAMEL-9505?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15096252#comment-15096252
] 

Andrea Cosentino commented on CAMEL-9505:
-----------------------------------------

Updated.

> RabbitMQConsumer don't use Camel ExceptionHandler BEFORE requeing message
> -------------------------------------------------------------------------
>
>                 Key: CAMEL-9505
>                 URL: https://issues.apache.org/jira/browse/CAMEL-9505
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-rabbitmq
>    Affects Versions: 2.16.1
>            Reporter: Arnaud CHOTARD
>            Assignee: Andrea Cosentino
>             Fix For: 2.15.6, 2.16.2, 2.17.0
>
>
> The use case is :
> onException(NotHandledException.class)
>    .handled(false)
>    .log("Exception not handled");
> onException(HandledException.class)
>    .handled(true)
>    .log("Exception handled");
> from("rabbitmq://...&autoAck=false")
>    .setHeader(RabbitMQConstants.REQUEUE, constant(true))
>    .to(...);
> If the route generate a NotHandledException, the message is requeue in RabbitMQ, it works
fine.
> If the route generate a HandledException, the message is requeue in RabbitMQ before the
execution of Camel ExceptionHandler wich should handle the exception and should not propagate
it. 
> The message handled by Camel ExceptionHandler should not be requeue in RabbitMQ since
the exception is handled.
> The related code is in :
> org.apache.camel.component.rabbitmq.RabbitConsumer.handleDelivery
> Maybe this line :
> getExceptionHandler().handleException("Error processing exchange", exchange, exchange.getException());
> should be before :
> if (deliveryTag != 0 && !consumer.endpoint.isAutoAck()) {
>    log.trace("Rejecting receipt [delivery_tag={}] with requeue={}", deliveryTag, isRequeueHeaderSet);
>    if (isRequeueHeaderSet) {
>       channel.basicReject(deliveryTag, true);
>    } else {
>       channel.basicReject(deliveryTag, false);
>    }
> }



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message