[
https://issues.apache.org/jira/browse/CAMEL-27044?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Work on CAMEL-27044 started by shashank.
----------------------------------------
> camel-core - starting a route that is already started starts its consumer
> again without RoutePolicy.onStart, so a MasterRoutePolicy slave can consume
> -----------------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-27044
> URL: https://issues.apache.org/jira/browse/CAMEL-27044
> Project: Camel
> Issue Type: Bug
> Components: camel-core
> Reporter: shashank
> Assignee: shashank
> Priority: Minor
>
> Found by the zookeeper-master DST world of CAMEL-26974 (PR #30137), in a case
> its default set leaves out: with {{-Ddst.zookeeper.startStartedRoute=true}} 8
> of 2000 seeds fail, because a node that is not the master consumes. Raised
> for discussion, as the fix is in camel-core and touches every route policy
> (davsclaus in the review of #30137: "may be worth a core-level look").
> h3. What happens
> {{startRoute}} on a route that is already Started does not go through
> {{RouteService.start()}} again (it is a started service, so the start is a
> no-op and {{RoutePolicy.onStart}} is not called), but
> {{InternalRouteStartupManager.doStartOrResumeRouteConsumers}} starts the
> consumer of the route again. This is on purpose for one case: {{isStartable}}
> notes that the consumer could be stopped, which is not reflected in the
> status of the route service.
> A route policy that keeps the consumer stopped while the route is Started is
> bypassed by that start: {{MasterRoutePolicy}} (camel-zookeeper-master) stops
> the consumer of a route on a node that lost or does not hold the mastership,
> and a {{startRoute}} from outside (JMX, the controlbus, the developer
> console, a route reload, the supervising route controller) starts the
> consumer again, so a slave consumes next to the master. Other policies that
> stop or suspend the consumer while the route stays Started can be affected
> the same way (for example the throttling policies and the scheduled route
> policy).
> h3. Expected
> A policy that controls whether the consumer runs is asked before the consumer
> of a started route is started again, or the start of a started route leaves a
> consumer that its policy stopped as it is.
> h3. Options to discuss
> * The start of a route that is already Started does nothing to its consumer
> (simplest, but changes the case {{isStartable}} was written for).
> * {{RoutePolicy.onStart}} (or a new callback) is called when the consumer of
> a started route is started again, so a policy can veto it.
> * The policies that keep the consumer stopped stop the route instead (changes
> what their users see in the route status).
> No branch yet; the choice decides the fix.
> _Filed with Claude Code on behalf of allthingssecurity._
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)