You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Andrea Cosentino (Jira)" <ji...@apache.org> on 2026/10/15 07:23:00 UTC

[jira] [Assigned] (CAMEL-25515) camel-jgroups-raft - the consumer's role change events do not handle the Learner role

     [ https://issues.apache.org/jira/browse/CAMEL-25515?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andrea Cosentino reassigned CAMEL-25515:
----------------------------------------

    Assignee: Andrea Cosentino

> camel-jgroups-raft - the consumer's role change events do not handle the Learner role
> -------------------------------------------------------------------------------------
>
>                 Key: CAMEL-25515
>                 URL: https://issues.apache.org/jira/browse/CAMEL-25515
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-jgroups
>            Reporter: Claus Ibsen
>            Assignee: Andrea Cosentino
>            Priority: Minor
>
> The jgroups-raft consumer with {{enableRoleChangeEvents=true}} does not handle the {{Learner}} role.
> {{CamelRoleChangeListener.roleChanged}} only maps {{Leader}} and {{Follower}}, and throws {{JGroupsRaftException("Role [Learner] unknown.")}} for anything else:
> {code:java}
> switch (role) {
>     case Leader: ... JGroupsRaftEventType.LEADER
>     case Follower: ... JGroupsRaftEventType.FOLLOWER
>     default:
>         throw new JGroupsRaftException("Role [" + role + "] unknown.");
> }
> {code}
> jgroups-raft 1.1.x (Camel uses 1.1.4.Final) has a third role, {{org.jgroups.protocols.raft.Role.Learner}}. {{Learner extends Follower}}: it replicates the log but cannot vote or become leader. {{RAFT._removeServer()}} moves a node that is removed from the members straight from {{Leader}} to {{Learner}}, without passing through {{Follower}}.
> RAFT catches the exception thrown by the listener, so nothing crashes, but the consumer route gets no event when its node steps down from leader. A route that starts work on {{LEADER}} and stops it on {{FOLLOWER}} keeps acting as leader after the node was removed.
> {{JGroupsRaftEventType}} has no {{LEARNER}} value either.
> h3. Proposal
> * Add {{JGroupsRaftEventType.LEARNER}} and send it for {{Role.Learner}} (or, if a new event type is not wanted, send {{FOLLOWER}} for it, since a learner is a non-voting follower).
> * Do not throw for an unknown role; log it at WARN so a future role does not silently drop events.
> * Document the new event type in the component docs, and add a unit test that calls {{roleChanged(Role.Learner)}}.
> h3. Context
> Found while reviewing https://github.com/apache/camel/pull/27613 (CAMEL-25488 / CAMEL-24598), which fixes the same gap in {{JGroupsRaftClusterView}} (the cluster service / master component side) but not in the consumer's {{CamelRoleChangeListener}}.
> _Created by Claude Code on behalf of Claus Ibsen._



--
This message was sent by Atlassian Jira
(v8.20.10#820010)