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

   Fixes [CAMEL-24749](https://issues.apache.org/jira/browse/CAMEL-24749).
   
   Since CAMEL-21630 (4.10.0) the `inheritErrorHandler` option of the failover 
load balancer is stored on `FailoverLoadBalancerDefinition` but nothing read 
it: `LoadBalanceReifier` still used the (now `@XmlTransient`, camel-jta only) 
flag on the `LoadBalanceDefinition` when wrapping the children, so 
`.loadBalance().failover(-1, false, true)` and `<failoverLoadBalancer 
inheritErrorHandler="false"/>` behaved as `true` - Camel's error handler 
exhausted its redeliveries on the failing endpoint before the load balancer 
failed over, instead of failing over immediately as documented.
   
   ### Change
   
   `LoadBalanceReifier` wraps the children with the failover definition's 
`inheritErrorHandler`, while the load balancer itself keeps inheriting so the 
route error handler can react once the failover is exhausted (the pre-4.10 
behaviour).
   
   ### Test
   
   `FailOverLoadBalanceInheritErrorHandlerTest`: with `maximumRedeliveries(2)`, 
`failover(-1, false, true)` calls the failing endpoint once before failing 
over, `failover(-1, true, true)` calls it three times. The first case fails on 
`main` without the fix (`Expected: <1> but was: <3>`). The existing 
`FailOverLoadBalanceNotInheritedErrorHandlerTest` did not catch this because 
its dead letter channel stops the exchange either way.
   
   Ran the camel-core `Failover*`/`FailOver*`/`LoadBalance*` suites and 
`ManagedFailoverLoadBalancerTest` - green.
   
   Affects 4.18.x and 4.22.x; the change is independent of #26449 (CAMEL-24696) 
and is a straight cherry-pick to both branches.
   
   _Claude Code on behalf of davsclaus_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
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