ammachado opened a new pull request, #31226: URL: https://github.com/apache/camel/pull/31226
# Description [CAMEL-27989](https://issues.apache.org/jira/browse/CAMEL-27989): the `config` option of the Resilience4j EIP configuration (and `camel.resilience4j.config`) refers to an `io.github.resilience4j.circuitbreaker.CircuitBreakerConfig` in the registry, but `ResilienceReifier` never read it (`git log -S getConfig()` on the component finds nothing). A referenced config was silently ignored and the resilience4j defaults were used. **Fix** (`ResilienceReifier`): - When `config` is set, the referenced `CircuitBreakerConfig` is looked up with `mandatoryLookup` (like the `circuitBreaker` option) and used as the base of the builder (`CircuitBreakerConfig.from(base)`). The other circuit breaker options set on the EIP are applied on top of it. The `defaultValue`s of the model options are doc-only (the fields stay `null` unless set), so only options the user actually set override the base. - When `config` is set, the record and ignore exception predicates of the resulting config are also passed to `ResilienceProcessor`. Otherwise the circuit breaker would ignore an exception of the base config while Camel still ran the fallback for it. Edge case: if a route sets Camel's `ignoreException` on top of a base config that has a custom ignore predicate, Camel's predicate replaces it, while the base config's ignore exception classes still apply (this is how `CircuitBreakerConfig.Builder(base)` copies a config). **Docs:** the option description now says it is the base configuration (model, camel-main, DSL builder javadoc, and the generated copies: model/main JSON, main.adoc, catalog, XSDs, YAML DSL schemas and deserializers). Upgrade guide entry in 4.25 (fixVersion 4.25.0), since routes that set `config` now get its values. **Tests:** new `ResilienceCircuitBreakerConfigTest`: base values are used, EIP options override the base while other base values remain, an ignored exception of the base config skips the fallback, and an unknown reference fails the route. All 4 fail against the unmodified reifier (50 instead of 30, 100 instead of 7, fallback used, no failure). The whole `camel-resilience4j` module passes locally (119 tests, 0 failures, 0 skipped). # Target - [x] I checked that the commit is targeting the correct branch (Camel 4 uses the `main` branch) # Tracking - [x] If this is a large change, bug fix, or code improvement, I checked there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL) filed for the change (usually before you start working on it). # Apache Camel coding standards and style - [x] I checked that each commit in the pull request has a meaningful subject line and body. - [ ] I have run `mvn clean install -DskipTests` locally from root folder and I have committed all auto-generated changes. Not from the root folder: I built `core/camel-core-model`, `core/camel-main`, `core/camel-xml-io`, `camel-spring-xml`, the YAML DSL modules and `components/camel-resilience4j`, and committed the generated changes. The one-line description in the YAML DSL generated files (`ModelDeserializers.java`, `camelYamlDsl*.json`) was updated by hand because the local YAML generator run did not pick up the new text; CI's uncommitted-changes check will confirm it matches. # AI-assisted contributions - [x] If this PR includes AI-generated code, commits have proper co-authorship attribution (e.g., `Co-authored-by` trailers) and the PR description identifies the AI tool used. 🤖 Generated with [Claude Code](https://claude.com/claude-code) on behalf of Adriano Machado (@ammachado) _This was generated by an AI agent and may contain inaccuracies. Please verify before relying on it._ -- 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]
