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

   # Description
   
   [CAMEL-26641](https://issues.apache.org/jira/browse/CAMEL-26641)
   
   The Aggregate EIP with `forceCompletionOnStop` or `completeAllOnStop` 
completed all its groups when its route was only suspended. The shutdown 
strategy calls `prepareShutdown` also for a suspend (`suspendOnly=true`), and 
`AggregateProcessor.prepareShutdown` ignored that flag. The partial 
aggregations went on through the route, and after the resume the rest of each 
group started a new one.
   
   A CamelContext suspend did not complete the groups 
(`forceCompletionOfAllGroups` refuses while the context is not started, with a 
WARN on every suspend). But with `completeAllOnStop` the aggregator still 
reported every group as pending, so the suspend waited for the whole shutdown 
timeout and then forced the routes down.
   
   Ways to get there: a route suspend from JMX, the control bus, the CLI, 
`DurationRoutePolicy` or the supervising route controller, and a CamelContext 
suspend. Route policies that only suspend the consumer 
(`ThrottlingInflightRoutePolicy`, the scheduled route policies) do not go 
through the shutdown strategy, so they never completed the groups. A route 
suspend now behaves the same.
   
   Found while checking the shutdown hooks of the EIPs (`ShutdownPrepared` / 
`ShutdownAware`) for state that a suspend should not touch, after CAMEL-26633 
(Loop EIP).
   
   Change (`AggregateProcessor`), as the error handlers 
(`RedeliveryErrorHandler`, the transaction error handlers) and the seda 
consumer (CAMEL-24949) already do:
   - `prepareShutdown` ignores a suspend;
   - `getPendingExchangesSize(boolean suspendOnly)` returns 0 for a suspend, 
because the groups are kept and there is nothing to wait for.
   
   A later stop still completes the kept groups. `completionTimeout` and 
`completionInterval` still apply during a suspend. The EIP doc says so, and the 
4.24 upgrade guide has a short entry with the way back: 
`forceCompletionOfAllGroups` (`AggregateController` or JMX) before the suspend, 
or stop the route instead. The other `ShutdownPrepared` processors in 
camel-core-processor (`WireTapProcessor`, `OnCompletionProcessor`) do nothing 
on `prepareShutdown`.
   
   Tests: `AggregateSuspendResumeTest`, 6 tests (route suspend + resume for 
both options, CamelContext suspend + resume for both options, and suspend then 
stop for both options). On main 5 fail (a suspend completed the group, or the 
CamelContext suspend took the whole 10 s timeout), and 1 control passes 
(CamelContext suspend with `forceCompletionOnStop`). With the fix 6/6, and 20 
runs each (120/120). Related camel-core tests (the aggregator package, 
`*Aggregat*`, `*Suspend*`, `*Shutdown*`, `*Resume*`): 383 (7 skipped), 0 
failures.
   
   For `main` only: `ShutdownAware.getPendingExchangesSize(boolean)` is new in 
4.23, and the change can be seen by users (upgrade guide entry). The 4.24 
upgrade guide entry may conflict with other PRs that add entries there; I will 
rebase as needed.
   
   # 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): 
[CAMEL-26641](https://issues.apache.org/jira/browse/CAMEL-26641).
   
   # 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 the core modules and camel-core with the formatter and 
import-sort plugins and ran the related camel-core tests. The EIP doc change is 
copied to the catalog. 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.
   
   _Claude Code on behalf of allthingssecurity_
   
   🤖 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