Created on 12-21-2017 10:19 PM - edited 08-17-2019 09:26 AM
Introduction into Process Group Variables
The ability configure variables at runtime in the UI was introduced in Apache NiFi 1.4 and will subsequently land in HDF 3.1. Variables can be referenced in property values of Processors and Controller Services that support expression language. This provides a centralized place to configure common values that may be referenced by multiple components and values that may be environmentally dependent. This guide provides a brief introduction to their usage.
Configuration
Variables are configured in a dialog that is accessed through the context menu.
The menu item is available when the selection is a single Process Group. Below is an example of what the variable dialog would look like.
The table will list all variables that are available in the scope of the current Process Group, the variable name, and variable value. Only variables defined in the current Process Group are editable. The table also contains a navigation link to go to the Process Group where inherited variables are defined. On the right side of the dialog, the variable selected in the table is shown along with all components that reference it.
Scoping
Processors and Controller Services encapsulated in the current Process Group will have access to variables defined at that Process Group and all ancestor Process Groups. If a nested Process Group defines a variable with the same name as one defined at a higher scope, it will override that value. This is visualized in the Variable dialog using a strikethrough. This overriding process can be summarized by saying that when a component references a variable, the value will come from the closest definition.
Additionally, variables defined in the properties files specified using the nifi.variable.registry.properties configuration can be overridden by Process Group Variables.
Referencing
Referencing a variable is done using expression language. If a Processor or Controller Service property supports expression language, a variable name can be used as the subject.
The order of precedence for expression language subjects is flow file attributes, Process Group variables, variables defined in the properties file, system environment variables, and finally JVM system property. For more information regarding Expression Language, please refer to the Expression Language Guide available in Apache NiFi.
Created on 07-03-2018 01:09 PM
Hello,
i would like to pass to ListSFTP processor some variables from DB but as far i know, this processor does not accept any flowfile as input. Is there a way to override processor group variables?
Other solutions are accepted aswell.
Thanks
Created on 02-03-2019 01:18 AM
The variables present in processGroup are not exported into templates, which i would like to use in minifi.
Created on 02-04-2019 02:32 PM
@Jayanth S Are the variable's your templated components referencing defined in a Process Group that is also part of this template?
Created on 02-05-2019 12:50 PM
Yes. One of the processor inside processor group is using that variable.
The variable is not exported but the value of the property is showing as ${'var'}. I am able to change the value using env variable.