Skip to content

Updating Custom Components to Apache NiFi 2.5.0

Dmitriy Myasnikov edited this page Oct 10, 2025 · 2 revisions

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.

Dependency Updates

Update NiFi Version in pom.xml

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>

Explicitly Declare nifi-api dependency

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.

Source Code Changes

Remove the @EventDriven Annotation

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:

@EventDriven

Failure to remove this annotation will result in compilation errors.

Update Expression Language Scope

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_REGISTRY

with:

ExpressionLanguageScope.ENVIRONMENT

This change ensures that your processor’s properties correctly support expression language evaluation in the new runtime model.

Adjust Unit Tests dealing with Controller Services and Expression Language

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);