Integration / Apache NiFi Interview Questions
What is the NiFi NAR (NiFi Archive) classloading model?
The NAR (NiFi ARchive) is the extension packaging format for NiFi components: processors, controller services, and reporting tasks. A NAR file is similar to a JAR but includes a special manifest that declares its dependencies and classloader parent chain. The NAR classloading model solves the dependency isolation problem — different processors may depend on conflicting versions of the same library.
Each NAR is loaded by its own NARClassLoader. When a processor in NAR A needs to load a class, the classloader first looks in NAR A's own classpath. Only classes not found there are delegated up the parent chain. Most NARs declare nifi-standard-services-api-nar or nifi-framework-api as their parent NAR, but do not share classloaders with sibling NARs.
This means NiFi can simultaneously run a processor using AWS SDK v1.x (in one NAR) and a processor using AWS SDK v2.x (in another NAR) without any classpath conflicts.
NARs are deployed by dropping them into NiFi's ./lib directory and restarting NiFi. NiFi 2.x introduces NAR Provider support for dynamically loading NARs at runtime without a restart, fetching from NiFi Registry or a Maven repository.
More Related questions...