Martin Zink created PLC4X-360:
---------------------------------
Summary: NiFi Plc4xSourceProcessor accepts but cannot resolve
multiple register values into a single flowfile attribute
Key: PLC4X-360
URL: https://issues.apache.org/jira/browse/PLC4X-360
Project: Apache PLC4X
Issue Type: Bug
Components: Integration-NiFi
Affects Versions: 0.11.0
Reporter: Martin Zink
NiFi's Plc4xSourceProcessor (and everything using
BasePlc4xProcessor::evaluateReadResponse) works unintuitively when querying
multiple registers at once.
Currently you can set which registers you want to read out with a JSON
structure e.g.
{code:json}
{
"foo" : "holding-register:20:UINT[13]",
}{code}
And the result will be written into the "foo" FlowFile attribute.
However in this specific case the result is not a single value, but an array of
values.
Due to this code
[https://github.com/apache/plc4x/blob/develop/plc4j/integrations/apache-nifi/nifi-plc4x-processors/src/main/java/org/apache/plc4x/nifi/BasePlc4xProcessor.java#L319-L328]
We discard the first N-1 values and only the last register value will be used
as a flowfile attribute.
I think it would be more appropriate to either
- create a comma separated list with all the values queried
- dinamically push these values into separate attributes (e.g. foo1, foo2,
foo3, etc..)
What do you think?
I'll gladly create a PR for this, if we can decide on what should happen in
these scenarios.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)