You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@plc4x.apache.org by "Otto Fowler (Jira)" <ji...@apache.org> on 2020/05/08 20:12:00 UTC

[jira] [Comment Edited] (PLC4X-196) Apache NiFi integration should allow Expression Language

    [ https://issues.apache.org/jira/browse/PLC4X-196?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17102904#comment-17102904 ] 

Otto Fowler edited comment on PLC4X-196 at 5/8/20, 8:12 PM:
------------------------------------------------------------

This is easy enough to add, but in looking at it, I have seen that connection and addresses are evaluated when the processor is scheduled and re-used.

This change would mean that the connections would actually have to be created each time the processor were triggered and the addresses too ( although I guess you could only do that if there were expressions present in either ).

Also, if you are going to process a lot of data, you would actually want to re-use the connection if possible, so then you get into maybe wanting to use a connection pool strategy.

If _just_ the addresses were to by dynamic and expression driven it would be more simple.
Then you would have to have addresses per connection/plc/processor.

[~cdutz], do you have an opinion here?


was (Author: ottobackwards):
This is easy enough to add, but in looking at it, I have seen that connection and addresses are evaluated when the processor is scheduled and re-used.

This change would mean that the connections would actually have to be created each time and the addresses too ( although I guess you could only do that if there were expressions present in either ).

Also, if you are going to process a lot of data, you would actually want to re-use the connection if possible, so then you get into maybe wanting to use a connection pool strategy.

If _just_ the addresses were to by dynamic and expression driven it would be more simple.
Then you would have to have addresses per connection/plc/processor.

[~cdutz], do you have an opinion here?

> Apache NiFi integration should allow Expression Language
> --------------------------------------------------------
>
>                 Key: PLC4X-196
>                 URL: https://issues.apache.org/jira/browse/PLC4X-196
>             Project: Apache PLC4X
>          Issue Type: New Feature
>          Components: Integration-NiFi
>    Affects Versions: 0.7.0
>            Reporter: Turker TUNALI
>            Priority: Major
>              Labels: feature-request
>
> 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()



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