[
https://issues.apache.org/jira/browse/CAMEL-26802?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Work on CAMEL-26802 started by shashank.
----------------------------------------
> camel-zookeeper-master - MasterRoutePolicy keeps the mastership after its
> route is removed, and does not keep the route of a slave stopped on start or
> resume
> -------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-26802
> URL: https://issues.apache.org/jira/browse/CAMEL-26802
> Project: Camel
> Issue Type: Bug
> Components: camel-zookeeper-master
> Reporter: shashank
> Assignee: shashank
> Priority: Major
>
> {{MasterRoutePolicy}} joins the ZooKeeper group in {{doStart}} and leaves it
> in {{doStop}}. The policy is added to the CamelContext as a service, so it
> only stops when the CamelContext stops. It does not override {{onRemove}},
> {{onStart}}, {{onSuspend}} or {{onResume}}.
> *A removed route keeps the mastership.* When the route is removed on the
> master (with {{removeRoute}}, or a route reload, which removes the route and
> adds it again), the policy stays in the group and stays the master, so no
> other node starts the route: it runs nowhere in the cluster. A reload with a
> new policy instance joins the group as a slave next to the old instance,
> which is still the master. On a slave, the policy of a removed route also
> stays in the group, and when it is elected later it starts the consumer of
> the removed route ({{route}} still points at it).
> *The route of a slave is kept stopped only by autoStartup=false.* The
> documentation asks for {{noAutoStartup()}}, as the policy starts the consumer
> when the node is elected. A {{startRoute}} or {{resumeRoute}} on a slave
> (from JMX, the controlbus, a scheduled route policy; {{resumeRoute}} starts a
> stopped route whose consumer does not support suspension) starts its
> consumer, and nothing stops it again, so the slave consumes next to the
> master.
> Expected: a removed route gives up the mastership (leaves the group), and a
> policy that gets a route again joins it again; a route of a slave that is
> started or resumed keeps its consumer stopped until the node is elected.
> The same gaps were fixed in {{HazelcastRoutePolicy}} with CAMEL-26784, which
> can serve as a reference.
> Found while reviewing CAMEL-26784, from reading the code on main; the
> onRemove case follows from the policy being a CamelContext service, the
> start/resume case is to be confirmed with a test.
> _Filed with Claude Code on behalf of allthingssecurity._
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)