davsclaus opened a new pull request, #26850: URL: https://github.com/apache/camel/pull/26850
_Claude Code on behalf of Claus Ibsen (davsclaus)_ JIRA: https://issues.apache.org/jira/browse/CAMEL-24994 A deep review of the Content Enricher EIPs (`Enricher` for enrich, `PollEnricher` for pollEnrich) found the same bug in both. Each fix has a test that fails without it. **The resource exchange's on completions were lost when the enrich failed.** The on completions (synchronizations) registered on the resource exchange were only handed over to the original exchange when the enrichment succeeded. They never ran when the resource failed, when the aggregation strategy threw an exception, or when it returned null. - **pollEnrich from a file:** when the aggregation failed, the polled file's on completion never ran. That on completion does the commit or rollback and removes the file from the in-progress repository. So the file stayed marked as in progress and was not polled again until the application restarted. The test polls a file whose first aggregation fails. Without the fix, the second poll gets nothing. - **enrich:** when the enrich failed, a producer's on completion for releasing a resource never ran. The http producer, for example, closes its response stream this way. The test uses a producer that registers an on completion, and checks that it runs when the resource fails, when the aggregation fails, and on success. Without the fix, only the success case runs it. The on completions are now handed over in every case, so they run with the original exchange, and `onFailure` runs when that exchange failed. Enrich still only hands them over when the unit of work is not shared, as before; with a shared unit of work they are already registered there. No outside PRs overlap with this area. ### Not changed (left for follow-up) - **`Enricher` never shuts down its producer cache.** Its internal `SendDynamicProcessor` is stopped in `doStop` but never shut down, so its producer cache is not shut down either. - **`variableReceive` on the failure path.** When the resource failed and `aggregateOnException` is not set, the failed resource message is copied onto the exchange, including when `variableReceive` is used. The exchange has failed in that case anyway. ### Tests - New `PollEnrichFileAggregationFailureTest` and `EnricherResourceCompletionTest`. Each fails without its fix. - All 114 `*Enrich*` and `*PollDynamic*` tests pass. - The full `core/camel-core` suite passes: 7571 tests, 0 failures, 44 skipped. 🤖 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]
