Parameters and Expression Language

When adding a Parameter that makes use of the Expression Language, it is important to understand the context in which the Expression Language will be evaluated. The expression is always evaluated in the context of the Process or Controller Service that references the Parameter. Take, for example, a scenario where Parameter with the name Time is added with a value of ${now()}. The Expression Language results in a call to determine the system time when it is evaluated. When added as a Parameter, the system time is not evaluated when the Parameter is added, but rather when a Processor or Controller Service evaluates the Expression. That is, if a Processor has a Property whose value is set to #{Time} it will function in exactly the same manner as if the Property's value were set to ${now()}. Each time that the property is referenced, it will produce a different timestamp.

Furthermore, some Properties do not allow for Expression Language, while others allow for Expression Language but do not evaluate expressions against FlowFile attributes. To help understand how this works, consider a Parameter named File whose value is ${filename}. Then consider three different properties, each with a different Expression Language Scope and a FlowFile whose filename is test.txt. If each of those Properties is set to #{File}, then the follow table illustrates the resultant value.

Configured Property Value Expression Language Scope Effective Property Value Notes

#{File}

FlowFile Attributes

test.txt

The filename is resolved by looking at the filename attribute.

#{File}

Variable Registry Only

Empty String

FlowFile attributes are not in scope, and we assume there is no Variable in the Variable Registry named "filename"

#{File}

None

${filename}

The literal text "${filename}" will be unevaluated.