Apache NiFi Guided Tour, part 3:
|
This is continued from Apache NiFi Guided Tour, part 2 in which we download a custom processor already written to bring it up in IntelliJ IDEA.
Outside of IDEA, at the command line, build the NAR thus:
~/dev/filter $ mvn clean package [INFO] Scanning for projects... [INFO] ------------------------------------------------------------------------ [INFO] Reactor Build Order: [INFO] [INFO] filter-parent [pom] [INFO] processor [jar] [INFO] filter [nar] [INFO] [INFO] ---------------< com.windofkeltia.filter:filter-parent >---------------- [INFO] Building filter-parent 1.0 [1/3] [INFO] --------------------------------[ pom ]--------------------------------- [INFO] [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ filter-parent --- [INFO] [INFO] -----------------< com.windofkeltia.filter:processor >------------------ [INFO] Building processor 1.0 [2/3] [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] ... [INFO] [INFO] --- nifi-nar-maven-plugin:1.4.0:nar (default-nar) @ filter --- [INFO] Copying nifi-api-1.19.1.jar to /home/russ/dev/filter/nar/target/classes/META-INF/bundled-dependencies/nifi-api-1.19.1.jar [INFO] Copying jakarta.activation-1.2.2.jar to /home/russ/dev/filter/nar/target/classes/META-INF/bundled-dependencies/jakarta.activation-1.2.2.jar [INFO] Copying processor-1.0.jar to /home/russ/dev/filter/nar/target/classes/META-INF/bundled-dependencies/processor-1.0.jar [INFO] Copying jaxb-runtime-2.3.5.jar to /home/russ/dev/filter/nar/target/classes/META-INF/bundled-dependencies/jaxb-runtime-2.3.5.jar [INFO] Copying jakarta.xml.bind-api-2.3.3.jar to /home/russ/dev/filter/nar/target/classes/META-INF/bundled-dependencies/jakarta.xml.bind-api-2.3.3.jar [INFO] Copying txw2-2.3.5.jar to /home/russ/dev/filter/nar/target/classes/META-INF/bundled-dependencies/txw2-2.3.5.jar [INFO] Copying nifi-utils-1.19.1.jar to /home/russ/dev/filter/nar/target/classes/META-INF/bundled-dependencies/nifi-utils-1.19.1.jar [INFO] Copying slf4j-api-2.0.6.jar to /home/russ/dev/filter/nar/target/classes/META-INF/bundled-dependencies/slf4j-api-2.0.6.jar [INFO] Copying istack-commons-runtime-3.0.12.jar to /home/russ/dev/filter/nar/target/classes/META-INF/bundled-dependencies/istack-commons-runtime-3.0.12.jar [INFO] Copying slf4j-simple-2.0.6.jar to /home/russ/dev/filter/nar/target/classes/META-INF/bundled-dependencies/slf4j-simple-2.0.6.jar [INFO] Copying jakarta.activation-api-1.2.2.jar to /home/russ/dev/filter/nar/target/classes/META-INF/bundled-dependencies/jakarta.activation-api-1.2.2.jar [INFO] Generating documentation for NiFi extensions in the NAR... [INFO] Found a dependency on version 1.19.1 of NiFi API [INFO] Building jar: /home/russ/dev/filter/nar/target/filter-1.0.nar [INFO] ------------------------------------------------------------------------ [INFO] Reactor Summary for filter-parent 1.0: [INFO] [INFO] filter-parent ...................................... SUCCESS [ 0.029 s] [INFO] processor .......................................... SUCCESS [ 1.596 s] [INFO] filter ............................................. SUCCESS [ 0.317 s] [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 2.505 s [INFO] Finished at: 2023-03-15T14:49:53-06:00 [INFO] ------------------------------------------------------------------------ ~/dev/filter $ ll nar/target total 1632 drwxrwxr-x 5 russ russ 4096 Mar 15 14:49 . drwxrwxr-x 3 russ russ 4096 Mar 15 14:49 .. drwxrwxr-x 3 russ russ 4096 Mar 15 14:49 classes -rw-rw-r-- 1 russ russ 1648352 Mar 15 14:49 filter-1.0.nar drwxrwxr-x 2 russ russ 4096 Mar 15 14:49 maven-archiver drwxrwxr-x 3 russ russ 4096 Mar 15 14:49 META-INF
The NAR we'll inject is named filter-1.0.nar. Here's how:
In my environment, Apache NiFi is installed on the path, ~/dev/nifi/nifi-1.19.1. We call this NIFI_ROOT.
$ ${NIFI_ROOT}/bin/nifi.sh restart
$ cd ${NIFI_ROOT} # set working directory to NiFi's root $ rm ./logs/*.log # remove existing logs to reduce clutter $ ./bin/nifi.sh restart # bounce NiFi $ tail -f ./logs/nifi-app.log # tail the log that will likely tell you what's wrong
The error most likely to keep NiFi from coming up (given that you've already experienced a working NiFi in part 1 of this guide) is that there's something with the NAR you built.
Let's try out our flow.
This is a test of the Emergency Broadcast System. This is only a test. The wily red fox jumped over the lazy dog's back and got clean away.while in the original flowfile they are:
This is a test of the Emergency Broadcast System. This is only a test. The quick brown fox jumped over the lazy dog's back and got clean away.
Here ends our Apache NiFi guided tour of installing NiFi, creating a custom processor and a flow that uses that new processor plus existing standard processors. For more information on Apache NiFi, consider the following links: