shashank created CAMEL-26080:
--------------------------------

             Summary: camel-jgroups - do not close a channel that the user gave 
to the component or an endpoint when Camel stops
                 Key: CAMEL-26080
                 URL: https://issues.apache.org/jira/browse/CAMEL-26080
             Project: Camel
          Issue Type: Improvement
          Components: camel-jgroups
            Reporter: shashank
            Assignee: shashank


{{JGroupsComponent.doStop}} closes the channel of the component ({{channel}} 
option of the component) and every channel given to an endpoint 
({{channel=#myChannel}}), as it did before CAMEL-25852. A {{JChannel}} cannot 
be connected again once it is closed ({{JChannel.checkClosed()}} throws 
{{IllegalStateException("channel is closed")}}), so a registry bean used as 
channel is unusable after the CamelContext is stopped and started again in 
place. Most Camel components leave a client the user supplied open and only 
close what they created.

Since CAMEL-25852 the endpoint knows whether it created its channel 
({{JGroupsEndpoint.isOwnChannel()}}), and the component counts the users of the 
other channels.

h3. Proposed fix

Close only the channels that the endpoints created. Disconnect (not close) the 
channels the user supplied when their last producer/consumer stops, as today, 
and leave them open at component stop. Upgrade guide entry: a user-supplied 
channel is no longer closed by Camel; close it yourself (for example as a bean 
with a destroy method).

Also: the component channel is closed at stop even when no endpoint ever used 
it (harmless, but goes with the change).

Tests: stop and start the CamelContext with {{channel=#bean}} and with the 
component channel; the routes receive again.

Relates to CAMEL-25852 (review of apache/camel#28325).

_Filed with Claude Code on behalf of allthingssecurity._



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to