-
Notifications
You must be signed in to change notification settings - Fork 6
Updating Custom Components to Apache NiFi 2.5.0
This document outlines the steps required to update custom Apache NiFi components (processors, controller services, reporting tasks, etc.) for compatibility with Apache NiFi version 2.5.0. The main changes involve dependency management, annotations, and expression language handling.
Depending on your configuration, update the NiFi version property or dependencies in your root pom.xml file, or in all pom.xml files throught the project.
For example, if you use properties to manage versions, update the nifi.version property:
<properties>
...
<nifi.version>2.5.0</nifi.version>
...
</properties>Starting with NiFi 2.x, the nifi-api module has been separated into its own JAR file. Therefore, any module that contains custom NiFi components (processors, controller services or reporting tasks) must add a dependency on nifi-api:
<dependency>
<groupId>org.apache.nifi</groupId>
<artifactId>nifi-api</artifactId>
<version>${nifi.api.version}</version>
<scope>provided</scope>
</dependency>For Apache NiFi 2.5.0, the compatible nifi-api version is 2.2.0.
The @EventDriven annotation is no longer supported in NiFi 2.x. Event-driven scheduling is now configured exclusively through the Scheduling Strategy dropdown in the NiFi UI (under the processor’s scheduling tab).
Remove all instances of the following annotation from your processor classes:
@EventDrivenFailure to remove this annotation will result in compilation errors.
NiFi 2.x no longer uses the VariableRegistry for expression language resolution. Instead, expression language evaluation now relies on environment variables.
Replace any usage of:
ExpressionLanguageScope.VARIABLE_REGISTRYwith:
ExpressionLanguageScope.ENVIRONMENTThis change ensures that your processor’s properties correctly support expression language evaluation in the new runtime model.
In NiFi 2.x, stricter validation of expression language usage was introduced during test execution. If your unit tests use properties to set up Controller Services or have property values that use expression language, you may encounter validation errors during test setup.
To avoid this, explicitly disable expression validation in your test runner after its creation:
testRunner = TestRunners.newTestRunner(ExampleProcessor.class);
testRunner.setValidateExpressionUsage(false);