davsclaus opened a new pull request, #26449: URL: https://github.com/apache/camel/pull/26449
Resolves [CAMEL-24696](https://issues.apache.org/jira/browse/CAMEL-24696) (option 2 - port the attribute on 4.23). `CircuitBreakerDefinition.inheritErrorHandler` and `FailoverLoadBalancerDefinition.inheritErrorHandler` were the last two model attributes still converted with `Boolean.valueOf` while deserializing, so a property placeholder was never resolved and `inheritErrorHandler: "{{flag}}"` silently evaluated to `false`. Since CAMEL-24697 (#26355) exposed the attribute in the YAML schema, `camel validate` accepted the placeholder while the runtime got it wrong. ### Changes - Both attributes are now `String` with `@Metadata(javaType = "java.lang.Boolean")`, like every other scalar attribute in the model. The `ProcessorDefinition.getInheritErrorHandler()`/`setInheritErrorHandler(...)` contract follows (the base field has been `@XmlTransient` and set only by camel-jta since CAMEL-21630). - `ProcessorReifier.wrapChannel(Processor, child)` and `LoadBalanceReifier` parse the value with the `CamelContext`; the `protected wrapChannel(..., Boolean)` overload and `ProcessorDefinitionHelper.shouldWrapInErrorHandler(..., Boolean)` are unchanged. - camel-jta passes `"false"`, camel-kamelet parses the value (and now passes the real `ModelCamelContext` to `shouldWrapInErrorHandler` instead of the route definition's not-yet-set context). - Fluent DSL unchanged: `CircuitBreakerDefinition.inheritErrorHandler(boolean)` and `LoadBalanceDefinition.failover(...)` keep their signatures; a `CircuitBreakerDefinition.inheritErrorHandler(String)` overload is added for placeholders. - Regenerated: `ModelParser`, `ModelWriter`, `YamlModelWriter`, `JavaDslModelWriter`, `ModelDeserializers`, `camel-spring.xsd` / `camel-xml-io.xsd` (the attribute is `xs:string` now, like `disabled`). The catalog model JSON and the YAML schema are unchanged (`type: boolean` comes from `javaType`). - Upgrade guide 4.23 entry, mirroring the CAMEL-24694 entry for `required`. - `YamlValidator.isRuntimeAcceptedScalar` Javadoc updated: `BeanConstructorDefinition.index` is the only remaining eagerly converted attribute (a map key, not portable - to be recorded as won't fix on the ticket). ### Tests - `ResilienceInheritErrorHandlerPlaceholderTest` (camel-resilience4j): `.circuitBreaker().inheritErrorHandler("{{myInherit}}")` resolves at route startup and Camel's error handler does the redeliveries. - `CircuitBreakerTest` / `LoadBalanceTest` (camel-yaml-dsl): the model keeps the raw placeholder for both attributes. - Ran: camel-xml-io (413), camel-yaml-io (148), camel-yaml-dsl-validator (96), camel-kamelet (83), camel-jta, camel-microprofile-fault-tolerance (27), camel-resilience4j inherit tests, and the camel-core load balancer / error handler subsets (233) - all green. ### Not in this PR While analysing the ticket I found that `failover(..., inheritErrorHandler=false, ...)` has been ignored at runtime since 4.10.0 (CAMEL-21630 moved the flag onto `FailoverLoadBalancerDefinition` without adding a reader). That is a separate bug with its own backport: [CAMEL-24749](https://issues.apache.org/jira/browse/CAMEL-24749). _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]
