allthingssecurity opened a new pull request, #29201: URL: https://github.com/apache/camel/pull/29201
# Description [CAMEL-26080](https://issues.apache.org/jira/browse/CAMEL-26080) `JGroupsComponent.doStop` closed the channel of the component (`channel` option) and every channel given to an endpoint (`channel=#myChannel`). A closed `JChannel` cannot be connected again (`JChannel.checkClosed()` throws `IllegalStateException: channel is closed`), so after the CamelContext was stopped and started again in place, the routes using such a channel failed to start. Most components leave a client that the user supplied open. Changes: - When the component stops, it only disconnects the channels it did not create (so the node leaves the cluster) and leaves them open. Normally the last producer or consumer has already disconnected them; a channel still in use by a producer that Camel does not stop is disconnected here. - The channels that the endpoints create (`channelProperties` or the default configuration) are closed as before (`JGroupsEndpoint`, unchanged). - Upgrade guide (4.24): a channel you give to Camel is no longer closed by Camel; close it yourself, for example as a bean with a destroy method. Tests (`JGroupsComponentChannelEndpointsTest`): - `stoppingTheCamelContextClosesTheChannels` becomes `stoppingTheCamelContextDisconnectsTheChannelsButDoesNotCloseThem`. - New `stoppingTheCamelContextDisconnectsTheChannelThatAProducerNotStoppedByCamelStillUses`: a producer the application started itself keeps the component channel connected until the CamelContext stops; the channel is then disconnected, not closed, and the producer's later stop does not throw. - New `theRoutesReceiveAgainAfterTheCamelContextIsStoppedAndStartedAgain`: with the same component channel and `channel=#endpointChannel` configured again, both channels are connected and both routes receive after a stop and start. Fails on main with `FailedToStartRouteException ... channel is closed`. - The 3 tests fail on main and pass with the change (20 runs in a row, 140/140); all camel-jgroups test classes pass offline (47 tests, 0 failures). - Also changed: a comment in `JGroupsEndpoint.doStop` that said the component closes such a channel. # 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-26080](https://issues.apache.org/jira/browse/CAMEL-26080). # 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 camel-jgroups and the modules it depends on, including the formatter and import-sort plugins, and ran the camel-jgroups 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]
