Claus Ibsen created CAMEL-27688:
-----------------------------------

             Summary: camel-jgroups-raft: timeout headers ignored, wrong header 
javaType and labels, unused enums
                 Key: CAMEL-27688
                 URL: https://issues.apache.org/jira/browse/CAMEL-27688
             Project: Camel
          Issue Type: Bug
          Components: camel-jgroups
            Reporter: Claus Ibsen
             Fix For: 4.24.0


Found while improving the option descriptions of camel-jgroups-raft for 
CAMEL-23832 (commit 
https://github.com/apache/camel/commit/111986fedb23011a30c5eaadc8e8e9726962d986).
These are separate problems of the component; the descriptions commit only 
documents the current behavior.

h4. 1. The timeout headers are ignored without the offset and length headers
{{JGroupsRaftProducer.process()}} calls {{RaftHandle.set(body, offset, length, 
timeout, unit)}} only when all four headers {{CamelJGroupsRaftSetOffset}}, 
{{CamelJGroupsRaftSetLength}}, {{CamelJGroupsRaftSetTimeout}} and 
{{CamelJGroupsRaftSetTimeUnit}} are set. A user who sets only the timeout and 
time unit headers gets {{set(body, 0, body.length)}}, which waits without a 
timeout until the set completes.
Use the timeout headers also when the offset and length headers are missing, 
with offset 0 and the body length.

h4. 2. Wrong javaType of four state headers
{{CamelJGroupsRaftLogSize}}, {{CamelJGroupsRaftCommitIndex}}, 
{{CamelJGroupsRaftCurrentTerm}} and {{CamelJGroupsRaftLastApplied}} have 
{{javaType = "int"}} in {{JGroupsRaftConstants}}, but {{RaftHandle.logSize()}}, 
{{commitIndex()}}, {{currentTerm()}} and {{lastApplied()}} return a {{long}} 
(jgroups-raft 1.1.4.Final), so 
{{JGroupsRaftEndpoint.populateJGroupsRaftHeaders()}} sets a {{Long}}.
Change the javaType to {{long}}.

h4. 3. The state headers are labeled consumer only
The seven state headers (log size, commit index, current term, is leader, last 
applied, leader address, raft id) have {{label = "consumer"}}, but 
{{JGroupsRaftProducer.process()}} also sets them after each set, through 
{{populateJGroupsRaftHeaders()}}.
Change the label to {{consumer,producer}}.

h4. 4. Unused values in the event type header
The {{CamelJGroupsRaftEventType}} header lists the enum values {{APPLY}}, 
{{READ_CONTENT_FROM}} and {{WRITE_CONTENT_TO}} of {{JGroupsRaftEventType}}. 
{{CamelRoleChangeListener.toEventType()}} only produces {{LEADER}} and 
{{FOLLOWER}}, and nothing else sets the header.
Remove (or deprecate) the unused values, or limit the documented enum to the 
two values that are sent.

h4. 5. Component option raftId is marked required
{{JGroupsRaftComponent.raftId}} has {{@Metadata(required = true)}}, but the 
code works without it: {{RaftHandle.raftId(null)}} keeps the {{raft_id}} of the 
channel configuration, and {{JChannel.name(null)}} is ignored. The endpoint 
option of the same name is not required.
Remove {{required = true}} from the component option.

h4. 6. Typo in the endpoint syntax
The {{syntax}} of {{@UriEndpoint}} on {{JGroupsRaftEndpoint}} is 
{{jgroup-raft:clusterName}} (missing {{s}}). The generated JSON shows 
{{jgroups-raft:clusterName}}, so only the source is affected.
Fix the syntax to {{jgroups-raft:clusterName}}.

_Claude Code on behalf of davsclaus_



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

Reply via email to