You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "Matt Burgess (JIRA)" <ji...@apache.org> on 2018/04/02 14:21:00 UTC

[jira] [Commented] (NIFI-4947) Bind dynamic properties in ScriptedLookupService as variables in script

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

Matt Burgess commented on NIFI-4947:
------------------------------------

This can be a convenience for script writers for sure, but it is fairly easy to get at the dynamic properties via the ProcessContext object passed into the various API methods such as onTrigger().  Here is a Groovy snippet for logging all dynamic property names, it uses ProcessContext.getProperties(), then filters each property on whether the PropertyDescriptor isDyanmic(). This technique can also be used with context.getProperty() in order to get its PropertyValue object, then evaluate Expression Language, etc.

{{context.properties.findAll {k,v -> k.dynamic}.each {k,v -> log.info(k.name)}}}

> Bind dynamic properties in ScriptedLookupService as variables in script
> -----------------------------------------------------------------------
>
>                 Key: NIFI-4947
>                 URL: https://issues.apache.org/jira/browse/NIFI-4947
>             Project: Apache NiFi
>          Issue Type: Wish
>          Components: Extensions
>    Affects Versions: 1.5.0
>            Reporter: Mohd Izhar Firdaus Bin Ismail
>            Priority: Minor
>
> It would be good to have dynamic properties declared on the ScriptedLookupService to be made available as variables in the script, like in the ExecuteScript processor. It would help with use-cases where user want to build a configurable LookupService using Jython etc. 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)