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

Otto Fowler updated PLC4X-219:
------------------------------
    Description: 
NIFI Flowfiles have 'automatic' attributes, that are there even if they aren't 
explicitly created by a flow processor.

The PLC4x processors use all the attributes when writing, this is incorrect.  
They will be writing the wrong things.

The usual pattern in NIFI is to have the attribute name follow a pattern, that 
can be read as a prefix, such as :

plc4x.address.

Then the processor looks for any attributes that start with that, and get the 
end of the address to use as the field name.

As is I would not think this processor would work in production.

Example of this pattern in NIFI: 
https://github.com/apache/nifi/blob/7d20c03f89358a5d5c6db63e631013e1c4be4bc4/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/InvokeHTTP.java#L132

This is slightly different, as the processor above is looking for configured 
values, where I believe that the plc4x processor just want to write anything 
with the attribute name value.

This is doubly wrong, as attributes are kept in a map.  There will never be 
more than one named value.

The proposed fix would be ->

- change the reads attribute to use a prefix pattern as  above
- only write out those that match through regex / capture




  was:
NIFI Flowfiles have 'automatic' attributes, that are there even if they aren't 
explicitly created by a flow processor.

The PLC4x processors use all the attributes when writing, this is incorrect.  
They will be writing the wrong things.

The usual pattern in NIFI is to have the attribute name follow a pattern, that 
can be read as a prefix, such as :

plc4x.address.

Then the processor looks for any attributes that start with that, and get the 
end of the address to use as the field name.

As is I would not think this processor would work in production.

Example of this pattern in NIFI: 
https://github.com/apache/nifi/blob/7d20c03f89358a5d5c6db63e631013e1c4be4bc4/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/InvokeHTTP.java#L132




> NIFI processors should only work with specific attributes
> ---------------------------------------------------------
>
>                 Key: PLC4X-219
>                 URL: https://issues.apache.org/jira/browse/PLC4X-219
>             Project: Apache PLC4X
>          Issue Type: Bug
>            Reporter: Otto Fowler
>            Priority: Critical
>
> NIFI Flowfiles have 'automatic' attributes, that are there even if they 
> aren't explicitly created by a flow processor.
> The PLC4x processors use all the attributes when writing, this is incorrect.  
> They will be writing the wrong things.
> The usual pattern in NIFI is to have the attribute name follow a pattern, 
> that can be read as a prefix, such as :
> plc4x.address.
> Then the processor looks for any attributes that start with that, and get the 
> end of the address to use as the field name.
> As is I would not think this processor would work in production.
> Example of this pattern in NIFI: 
> https://github.com/apache/nifi/blob/7d20c03f89358a5d5c6db63e631013e1c4be4bc4/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/InvokeHTTP.java#L132
> This is slightly different, as the processor above is looking for configured 
> values, where I believe that the plc4x processor just want to write anything 
> with the attribute name value.
> This is doubly wrong, as attributes are kept in a map.  There will never be 
> more than one named value.
> The proposed fix would be ->
> - change the reads attribute to use a prefix pattern as  above
> - only write out those that match through regex / capture



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to