davsclaus opened a new pull request, #29399: URL: https://github.com/apache/camel/pull/29399
## Description [CAMEL-26729](https://issues.apache.org/jira/browse/CAMEL-26729): a regression of CAMEL-26712 (#29380), on main only. Since CAMEL-26712, `ExchangeHelper.isRedelivered` reads the redelivery counter of the exchange first (so a route that removes the `Camel*` headers is still counted). When an `onException` that does not handle the failure (or the failure processor of another error handler) takes over, `RedeliveryErrorHandler.decrementRedeliveryCounter()` takes back the redelivery it counted for the failed attempt, but only in the `CamelRedeliveryCounter` and `CamelRedelivered` headers, not in the counter of the exchange. The exchange then still reads as redelivered, and the route MBean counts a redelivery that never happened. Seen in CI of the chaos PRs: `JMSTransactionIsTransactedRedeliveredIT` fails all its attempts with `Redeliveries` expected 0 but was 2 (a transacted route with a `TransactionErrorHandler`, and an `onException` that does not handle the failure). Reverting the `isRedelivered` change of #29380 locally makes it pass, and so does this fix. The fix: `decrementRedeliveryCounter()` also sets the counter of the exchange, as `incrementRedeliveryCounter()` does. ## Tests - New `ManagedFailureWithoutRedeliveryTest` (camel-management): a failure seen by an `onException` without `handled` is not redelivered (exchange counter, header, route `Redeliveries` 0); fails without the fix (`expected: <false> but was: <true>`). A failure after redeliveries still counts one. - `JMSTransactionIsTransactedRedeliveredIT` passes locally with the fix. - camel-management redelivery/route/error handler tests: 85 green; camel-core `*Redeliver*,*ErrorHandler*,*OnException*,*DeadLetter*`: 703 green. _Claude Code on behalf of Claus Ibsen_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_012nJsFsjqqFiwroeHRWaKbS -- 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]
