Processor API
The Processor is the most widely used Component available in NiFi. Processors are the only Component to which access is given to create, remove, modify, or inspect FlowFiles (data and attributes).
All Processors are loaded and instantiated using Java's ServiceLoader mechanism. This means that all Processors must adhere to the following rules:
-
The Processor must have a default constructor.
-
The Processor's JAR file must contain an entry in the META-INF/services directory named
org.apache.nifi.processor.Processor
. This is a text file where each line contains the fully-qualified class name of a Processor.
While Processor
is an interface that can be implemented directly, it will be extremely rare to do so, as the org.apache.nifi.processor.AbstractProcessor
is the base class for almost all Processor implementations. The AbstractProcessor
class provides a significant amount of functionality, which makes the task of developing a Processor much easier and more convenient. For the scope of this document, we will focus primarily on the AbstractProcessor
class when dealing with the Processor API.
NiFi is a highly concurrent framework. This means that all extensions must be thread-safe. If unfamiliar with writing concurrent software in Java, it is highly recommended that you familiarize yourself with the principles of Java concurrency.