[ 
https://issues.apache.org/jira/browse/CAMEL-26712?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Claus Ibsen resolved CAMEL-26712.
---------------------------------
    Resolution: Fixed

Fixed by https://github.com/apache/camel/pull/29380 (merged on main for 4.24.0).

_Claude Code on behalf of davsclaus_

> camel-management - an exchange recovered by a redelivery is not counted when 
> the route removes the CamelRedelivered header
> --------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-26712
>                 URL: https://issues.apache.org/jira/browse/CAMEL-26712
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>            Priority: Major
>             Fix For: 4.24.0
>
>
> The JMX statistics count an exchange as redelivered (the {{redeliveries}} 
> counter of a route, a processor and the CamelContext, also shown by the dev 
> consoles, camel get route and the TUI) by the {{CamelRedelivered}} message 
> header: {{ManagedPerformanceCounter.isRedeliveredHere}}, 
> {{ManagedRoute.isRedeliveredHere}} and {{ManagedProcessor.isRedeliveredHere}} 
> call {{ExchangeHelper.isRedelivered(exchange)}}, which reads 
> {{exchange.getIn().getHeader(Exchange.REDELIVERED)}}.
> A route that removes the Camel headers after the redelivery, which is common 
> before calling an HTTP or mail endpoint (as the docs recommend: 
> {{removeHeaders("Camel*")}}), takes the header away. The exchange then 
> completes after a redelivery but the route counts no redelivery.
> How to reproduce:
> {code:java}
> onException(IllegalStateException.class).maximumRedeliveries(2).redeliveryDelay(0);
> from("direct:orders").routeId("orders")
>     .process(e -> { if (calls.incrementAndGet() % 2 == 1) throw new 
> IllegalStateException("stock down"); })
>     .removeHeaders("Camel*");
> {code}
> Send one message: it fails once, is redelivered and completes. The route's 
> {{Redeliveries}} attribute is 0. Without the {{removeHeaders}} it is 1.
> In the chaos demo (camel-chaos failing the stock call), chaos counted 212 
> orders recovered by redelivery, the route counter 46.
> The redelivery state belongs on the exchange, not only in a message header 
> that a route may remove or a producer may send on. Options:
> * mark it on the {{ExchangeExtension}} (or an internal exchange property) 
> where {{RedeliveryErrorHandler}} sets the header, and let 
> {{isRedeliveredHere}} read that;
> * or count from the {{ExchangeRedeliveryEvent}} per route, as the new 
> timeline dev console does (CAMEL-26691).
> Found while building the timeline (CAMEL-26691), which counts recoveries from 
> the redelivery events and is not affected.
> _Claude Code on behalf of Claus Ibsen_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to