allthingssecurity opened a new pull request, #29366: URL: https://github.com/apache/camel/pull/29366
# Description [CAMEL-26602](https://issues.apache.org/jira/browse/CAMEL-26602) `suspendRoute` on a route that is not started (stopped, or `autoStartup=false` and never started) suspended the route service anyway, as `BaseService.suspend()` does not check the current status, so the route reported `Suspended`. A later `startRoute` or `resumeRoute` then only resumed the route service: the consumer, which was stopped, was not started, and the route reported `Started` while it consumed nothing. Callers that reach this: JMX (`ManagedSuspendableRoute`), the dev console, the control bus, route policies (`RoutePolicySupport.suspendRoute`), and the Camel CLI, whose suspend of all routes calls `suspendRoute` for every route, the stopped ones too. Also a stop and a suspend of the same route from two places, in that order. Found with Fray (controlled concurrency testing for the JVM): stop, suspend and start of one route on three threads; in the order stop, suspend, start the route was `Started` with a stopped consumer. Change (`AbstractCamelContext.suspendRoute`): a route whose route service is not started is left as it is (DEBUG log), like the CamelContext suspend, which only suspends the started routes. The `RouteController.suspendRoute` javadoc says so. Tests: `RouteSuspendStoppedRouteTest` (stop + suspend + start, stop + suspend + resume, not auto started + suspend + resume, and a started route suspend + resume as control). On main 3 of 4 fail (the control passes); with the fix 4/4, and 20 runs each. Related camel-core tests (`*Suspend*`, `*Resume*`, route policies, route controllers, health checks): 68, 0 failures. Behaviour change: `suspendRoute` on a route that is not started no longer changes its status to `Suspended` (and route policies no longer get `onSuspend` for it). # 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-26602](https://issues.apache.org/jira/browse/CAMEL-26602). # 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; no generated file changes. 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]
