Integration / Apache NiFi Interview Questions
What is the UpdateAttribute processor and how is its Advanced Mode used?
UpdateAttribute is one of the most versatile NiFi processors. In basic mode, each User-Defined Property becomes an attribute name, and its value (which can use NiFi Expression Language) becomes the new attribute value. Adding a property processed.timestamp with value ${now():format('yyyy-MM-dd HH:mm:ss')} stamps every FlowFile with a timestamp attribute.
Advanced Mode (accessible via the Advanced button in the processor configuration dialog) adds rule-based conditional attribute modification. You define rules, each with:
- A set of conditions — boolean EL expressions that must all be true for the rule to apply (e.g.,
${mime.type:equals('application/json')}) - A set of actions — attribute name/value pairs applied when the rule matches
Multiple rules are evaluated in order; the FlowPolicy setting controls whether to use the first matching rule or all matching rules. This allows a single UpdateAttribute processor to implement complex attribute-setting logic without chaining multiple processors or writing scripts.
Common basic-mode uses include: computing dynamic file paths from multiple attributes, incrementing retry counters, setting MIME types, building database connection parameters from environment attributes, and normalizing attribute naming conventions.
More Related questions...