Overview
Apache NiFi (incubating) processors are typically organized in processor bundles. A processor bundle is generally composed of the following:
...
An example processor bundle from the NiFi distribution is the nifi-kafka-bundle, containing the sub-projects nifi-kafka-processors and nifi-kafka-nar.
Maven Archetype
NiFi provides a Maven archetype for easily creating this project structure. To use the archetype, run the following Maven command:
...
Property | Description |
---|---|
groupId | The Maven groupId for the new bundle. |
artifactId | The Maven artifactId for the new bundle. Generally something like "nifi-basename-bundle", where basename is specific to your bundle. |
version | The Maven version for the new bundle. |
artifactBaseName | The base name from the artifactId. For example, to create a helloworld bundle, the artifactBaseName would be helloworld, and the artifactId would be nifi-helloworld-bundle. |
package | The Java package for the processors. |
Processor Bundle Structure
A processor bundle created with the archetype will create the following project structureThis will create a project structure like the following:
nifi-basename-bundle├── nifi-basename-nar│ └── pom.xml├── nifi-basename-processors│ ├── pom.xml│ └── src│ ├── main│ │ ├── java│ │ │ └── org.apache.nifi.processors.basename│ │ │ └── MyProcessor.java│ │ └── resources│ │ ├── META-INF│ │ │ └── services│ │ └── org.apache.nifi.processor.Processor│ └── test│ └── java│ └── org.apache.nifi.processors.basename│ └── MyProcessorTest.java└── pom.xml
The default processor generated by the archetype is called MyProcessor. If you decide to rename this processor, make sure to also update the org.apache.nifi.processor.Processor file. This file is used by NiFi to locate available processors, and the fully qualified class name of the processor must be listed here in order for it to be available from the user interface.
Inheritance
By default, the newly generated bundle will inherit from the nifi-nar-bundles artifact from Apache NiFi, for the given nifiVersion that was specified. This is well suited for bundles that plan to be included with Apache NiFi, or plan to be Apache licensed, but it may not be desired in all cases. If it is preferred to not inherit from the nifi-nar-bundles artifact, then the newly generated bundle can be modified in the following ways:
- Remove the <parent>...</parent> from the bundle's root pom, or replace it with another desired parent
Add the nar plugin to bundle's root pom (ensure the latest version of the nar plugin is being used):
<build>
<plugins>
<plugin>
<groupId>org.apache.nifi</groupId>
<artifactId>nifi-nar-maven-plugin</artifactId>
<version>1.0.1-incubating</version>
<extensions>true</extensions>
</plugin>
</plugins>
</build>
- Specify the necessary dependency versions in the bundle's processors pom. This is required because the default behavior is for the dependencies to inherit their versions through the nifi-nar-bundle parent, so with a different parent these versions will have to be explicitly set. In addition these dependencies should be changed to provided since they will be provided by NiFi.