Adding Functionality to Apache NiFi
Also available as:
PDF
loading table of contents...

Enrich/Modify Content

The Enrich/Modify Content pattern is very common and very generic. This pattern is responsible for any general content modification. For the majority of cases, this Processor is marked with the @SideEffectFree and @SupportsBatching annotations. The Processor has any number of required and optional Properties, depending on the Processor's function. The Processor generally has a success and failure relationship. The failure relationship is generally used when the input file is not in the expected format.

This Processor obtains a FlowFile and updates it using the ProcessSession's write(StreamCallback) method so that it is able to both read from the FlowFile's content and write to the next version of the FlowFile's content. If errors are encountered during the callback, the callback will throw a ProcessException. The call to the ProcessSession's write method is wrapped in a try/catch block that catches ProcessException and routes the FlowFile to failure.

If the callback succeeds, a CONTENT_MODIFIED Provenance Event is emitted.