allthingssecurity opened a new pull request, #26789: URL: https://github.com/apache/camel/pull/26789
# Description [CAMEL-24944](https://issues.apache.org/jira/browse/CAMEL-24944) With optimistic locking and a pre-completing `AggregationStrategy`, `doAggregation` removed the pre-completed group from the repository into a local list, then added the new group. If that add failed with `OptimisticLockingException`, the exchange was retried and the local list was dropped, so the pre-completed group was never sent. With the normal lock, the same list was dropped when the strategy threw after a pre-completion, or when `discardOnAggregationFailure` discarded the new exchange. This change: `doProcess` owns the list of completed exchanges, `doAggregation` adds to it as soon as a group is completed (removed from the repository), and `doProcess` submits the list in a `finally` block outside the lock. Groups that were already completed are sent even if the aggregation fails afterwards or is retried. Tests: new `AggregatePreCompleteLostGroupTest` covers an optimistic-locking retry after a pre-completion, a strategy that throws after a pre-completion, and discard on aggregation failure. Without the fix, all 3 fail (message counts 2/3, 0/1, 0/1). With the fix they pass. The aggregator suites pass. Note: this and #PR_F2 (CAMEL-24943) both change `doAggregation`'s signature, so whichever merges second needs a small rebase. Found with a TLA+ model of the Aggregate EIP (a completed group lost), then reproduced against the real classes. # 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. (I built and tested the affected modules, including the formatter and import-sort plugins. I did not run the full root build.) # 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. This PR was prepared with Claude Code (Claude Opus 5.5). The commit carries a `Co-Authored-By` trailer. -- 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]
