Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apache NiFi integration should allow Expression Language #593

Closed
ottlukas opened this issue Nov 9, 2022 · 0 comments · Fixed by #1122
Closed

Apache NiFi integration should allow Expression Language #593

ottlukas opened this issue Nov 9, 2022 · 0 comments · Fixed by #1122
Labels
integration-nifi https://plc4x.apache.org/users/integrations/apache-nifi.html MAJOR

Comments

@ottlukas
Copy link
Contributor

ottlukas commented Nov 9, 2022

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

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. Original Jira may contain additional context.
Reported by: turker.tunali.

@ottlukas ottlukas added MAJOR new feature integration-nifi https://plc4x.apache.org/users/integrations/apache-nifi.html labels Nov 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integration-nifi https://plc4x.apache.org/users/integrations/apache-nifi.html MAJOR
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant