davsclaus opened a new pull request, #29380:
URL: https://github.com/apache/camel/pull/29380

   ## Problem
   
   The JMX statistics count an exchange as redelivered (the `Redeliveries` 
attribute of a route, a processor and the CamelContext, also shown by the dev 
consoles, `camel get route` and the TUI) with `ExchangeHelper.isRedelivered`, 
which read only the `CamelRedelivered` header.
   
   A route that removes the Camel headers after the redelivery took that header 
away. That's common before calling an HTTP or mail endpoint: 
`removeHeaders("Camel*")`. The exchange completed after a redelivery, but the 
route counted no redelivery. In a chaos demo, camel-chaos counted 212 orders 
recovered by redelivery, and the route counter 46.
   
   ## Fix
   
   - `ExchangeHelper.isRedelivered` first reads the redelivery counter of the 
exchange (`ExchangeExtension.getRedeliveryCounter()`), which 
`RedeliveryErrorHandler` keeps next to the header and a route cannot remove. 
The header still counts as before, for the processors that set only the header 
(poll enrich, aggregate recovery).
   - `RedeliveryErrorHandler`: a continued failure (`continued(true)`) now also 
resets that counter, as a handled failure already did. Otherwise a continued 
exchange would count as redelivered.
   - camel-chaos uses the same helper for its effect counts, so it gets the 
same fix.
   - Upgrade guide note for 4.24.
   
   ## Tests
   
   - `ManagedRedeliverRemoveHeadersTest`: a route that removes `Camel*` after 
the redelivery and one that keeps the headers both count 1 redelivery (route 
and processor), and the header is really gone. A continued failure counts no 
redelivery.
   - Ran locally: the camel-management redelivery and failure tests, the 
camel-core error-handling tests (`*Redeliver*`, `*Continued*`, `*OnException*`, 
`*DeadLetter*`, `*ErrorHandler*`, `*Redelivery*`: 715) and camel-chaos (657). 
All pass.
   
   JIRA: https://issues.apache.org/jira/browse/CAMEL-26712
   
   _Claude Code on behalf of Claus Ibsen_
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to