ottlukas opened a new issue, #593:
URL: https://github.com/apache/plc4x/issues/593

   Apache NiFi integration should allow us to use Expression Language for PLC 
connection string and PLC resource address string.
   
   We sometimes need to get data from 100 different addresses. Current 
processors doesn't allow us to create those strings on the fly. So we need to 
enter them manually or we need utilize NiFi API to create flows automatically. 
   
   If those parameters allows us to use expression language, we can read a list 
from csv file or from database and then we can read them in a loop in Apache 
NiFi.  
   
   So it will be very handy feature to dynamically specify the connection 
string and the address string.
   
   For starting point PutFile processor can be examined. This processor 
utilizes expression language for it's "Directory" parameter.
   
   
[https://github.com/apache/nifi/blob/master/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/PutFile.java](https://github.com/apache/nifi/blob/master/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/PutFile.java)
   
   Notable Lines:
   
   import org.apache.nifi.expression.ExpressionLanguageScope;
   
   ...
   
   Define the parameter as expression language supported.
   
   public static final PropertyDescriptor DIRECTORY = new 
PropertyDescriptor.Builder()
    .name("Directory")
    .description("The directory to which files should be written. You may use 
expression language such as /aa/bb/${path}")
    .required(true)
    .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
    *.expressionLanguageSupported(ExpressionLanguageScope.FLOWFILE_ATTRIBUTES)*
    .build();
   
   ...
   
   And then script can be evaluated in the onTrigger event like
   
   
context.getProperty(DIRECTORY).evaluateAttributeExpressions(flowFile).getValue()
   
   Imported from Jira 
[PLC4X-196](https://issues.apache.org/jira/browse/PLC4X-196). Original Jira may 
contain additional context.
   Reported by: turker.tunali.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to