Claus Ibsen created CAMEL-26181:
-----------------------------------
Summary: camel-tahu - tahu-host delivers each Sparkplug message
twice, and tahu-edge can never set the payload body from the message body
Key: CAMEL-26181
URL: https://issues.apache.org/jira/browse/CAMEL-26181
Project: Camel
Issue Type: Bug
Components: camel-tahu
Reporter: Claus Ibsen
Fix For: 4.24.0
Found while adding the catalog body types of tahu-edge and tahu-host
(CAMEL-24961, PR #28411).
h4. 1. tahu-host gives two identical exchanges for each Sparkplug message
{{MultiTahuHostApplicationEventHandler}} passes each message to the consumer
from its specific callback ({{onNodeBirthArrived}}, {{onNodeDataArrived}},
{{onDeviceDataArrived}} and the others, main 2a465aa4814c, lines 42 to 87) and
again from {{onMessage}} (lines 110 to 115), so
{{TahuHostConsumer.onMessageConsumer}} runs twice and the route gets two
identical exchanges per message. On top, {{onMetricConsumer}} (TahuHostConsumer
line 167) sends one more exchange per metric. Checked on 4.24.0-SNAPSHOT end to
end with the test-infra HiveMQ container.
Proposed: forward a message from one of the two paths only, and document
whether the per-metric exchanges are meant.
h4. 2. tahu-edge can never take the payload body from the message body
{{TahuEdgeProducer.process}} (main 2a465aa4814c, lines 114 to 117) converts the
message to a {{SparkplugBPayload}} only when the body is null, by setting the
message itself as the body.
{{TahuEdgePayloadConverter.messageToSparkplugBPayload}} (line 61) then skips
the body because it is the message ({{body != message}}), so the payload body
is never set. A text or bytes body has no converter to {{SparkplugBPayload}}
and fails with an {{InvalidPayloadException}}. The
{{TahuEdgeProducerRouteBuilder}} test passes only because the simulator's
payload body is null. Checked on 4.24.0-SNAPSHOT end to end with the test-infra
HiveMQ container.
Proposed: for a body that is not a {{SparkplugBPayload}}, build the payload
from the headers and set the body converted to {{byte[]}} as the payload body,
and test it with a non-null body.
_Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)