UpdateAttribute

Description:

Updates the Attributes for a FlowFile by using the Attribute Expression Language and/or deletes the attributes based on a regular expression

Additional Details...

Tags:

attributes, modification, update, delete, Attribute Expression Language, state

Properties:

In the list below, the names of required properties appear in bold. Any other properties (not in bold) are considered optional. The table also indicates any default values, and whether a property supports the NiFi Expression Language.

Display NameAPI NameDefault ValueAllowable ValuesDescription
Delete Attributes ExpressionDelete Attributes ExpressionRegular expression for attributes to be deleted from FlowFiles. Existing attributes that match will be deleted regardless of whether they are updated by this processor.
Supports Expression Language: true (will be evaluated using flow file attributes and Environment variables)
Store StateStore StateDo not store state
  • Do not store state
  • Store state locally
Select whether or not state will be stored. Selecting 'Stateless' will offer the default functionality of purely updating the attributes on a FlowFile in a stateless manner. Selecting a stateful option will not only store the attributes on the FlowFile but also in the Processors state. See the 'Stateful Usage' topic of the 'Additional Details' section of this processor's documentation for more information
Stateful Variables Initial ValueStateful Variables Initial ValueIf using state to set/reference variables then this value is used to set the initial value of the stateful variable. This will only be used in the @OnScheduled method when state does not contain a value for the variable. This is required if running statefully but can be empty if needed.
Cache Value Lookup Cache Sizecanonical-value-lookup-cache-size100Specifies how many canonical lookup values should be stored in the cache

Dynamic Properties:

Supports Sensitive Dynamic Properties: No

Dynamic Properties allow the user to specify both the name and value of a property.

NameValueDescription
A FlowFile attribute to updateThe value to set it toUpdates a FlowFile attribute specified by the Dynamic Property's key with the value specified by the Dynamic Property's value
Supports Expression Language: true (will be evaluated using flow file attributes and Environment variables)

Relationships:

NameDescription
successAll successful FlowFiles are routed to this relationship

Reads Attributes:

None specified.

Writes Attributes:

NameDescription
See additional detailsThis processor may write or remove zero or more attributes as described in additional details

State management:

ScopeDescription
LOCALGives the option to store values not only on the FlowFile but as stateful variables to be referenced in a recursive manner.

Restricted:

This component is not restricted.

Input requirement:

This component requires an incoming relationship.

Example Use Cases:

Use Case:

Add a new FlowFile attribute

Configuration:

Leave "Delete Attributes Expression" and "Stateful Variables Initial Value" unset.

Set "Store State" to "Do not store state".

Add a new property. The name of the property will become the name of the newly added attribute.

The value of the property will become the value of the newly added attribute. The value may use the NiFi Expression Language in order to reference other

attributes or call Expression Language functions.



Use Case:

Overwrite a FlowFile attribute with a new value

Configuration:

Leave "Delete Attributes Expression" and "Stateful Variables Initial Value" unset.

Set "Store State" to "Do not store state".

Add a new property. The name of the property will become the name of the attribute whose value will be overwritten.

The value of the property will become the new value of the attribute. The value may use the NiFi Expression Language in order to reference other

attributes or call Expression Language functions.

For example, to change the txId attribute to the uppercase version of its current value, add a property named txId with a value of ${txId:toUpper()}



Use Case:

Rename a file

Configuration:

Leave "Delete Attributes Expression" and "Stateful Variables Initial Value" unset.

Set "Store State" to "Do not store state".

Add a new property whose name is filename and whose value is the desired filename.

For example, to set the filename to abc.txt, add a property named filename with a value of abc.txt.

To add the txId attribute as a prefix to the filename, add a property named filename with a value of ${txId}${filename}.

Or, to make the filename more readable, separate the txId from the rest of the filename with a hyphen by using a value of ${txId}-${filename}.



System Resource Considerations:

None specified.