Best practices for building custom components
Learn about general guidelines concerning the creation of custom NiFi archives (NARs).
The goal is to build your code once against a baseline version of Apache NiFi and it can be deployed to any flow you need using any version of Cloudera DataFlow powered by any NiFi deployment equal to or greater than the version it was built against, bar major version changes.
Apache NiFi extensions are packaged in NARs. A NAR allows several components and their dependencies to be packaged together into a single package. NiFi provides Maven archetypes for creating custom processor and controller service bundle project structures. For detailed information, see the Maven Projects for Extensions Apache NiFi wiki page.
- If directly specifying the
nifi-nar-maven-plugin
, ensure you use the most recent version when compiling your custom code. - If inheriting the
nifi-nar-maven-plugin
, Cloudera recommends that the parent version ofnifi-nar-bundles
has the same major and minor version as the selected NiFi runtime version. For example, If the CFM Version is 1.18.0.2.3.7.1 (NiFi Major Version: 1, NiFi Minor Version: 18) the recommended compilation version is 1.18.0 (The first two version numbers must be equal to, or less than the CFM version).<parent> <groupId>org.apache.nifi</groupId> <artifactId>nifi-nar-bundles</artifactId> <version>1.18.0.2.3.7.1-1</version> </parent>
- Ensure your NAR
pom
only depends on another NARpom
for a controller service API NAR. Generally, do not extend from implementation NARs likenifi-standard-nar
. - Ensure your components
jar
pom
marks API dependencies as provided in order to obtain them at runtime through the appropriate NAR dependency.