Thursday 12 October 2017

How to Make a New Processor in NiFi (IntelliJ/Windows)

This guide will demonstrate to create a new NiFi processor in Java using the IntelliJ IDE and Windows.

1) Download the JDK from the Oracle website here.
2) Download IntelliJ from the JetBrains website here.
3) Download Mavern from the Apache website here. (Note I am not sure if this is an actual required step and therefore this may be bundled with IntelliJ)
4) Setup the Mavern class path, you should be able to run "mvn -version" from the command line
5) In the command line choose a folder you would like to create your processors in "cd /Documents/Nifi-Development"
6) Run the Nifi setup command: "mvn archetype:generate -DarchetypeGroupId=org.apache.nifi -DarchetypeArtifactId=nifi-processor-bundle-archetype -DarchetypeVersion=1.0.0 -DnifiVersion=1.0.0"
7) The sample values should be as followed where yourbundle is the name of the processor you want to create
Define value for property 'groupId': org.apache.nifi.processors.yourbundle 
Define value for property 'artifactId': nifi-yourbundle-bundle
Define value for property 'version' 1.0-SNAPSHOT: : 1.0
Define value for property 'artifactBaseName': yourbundle 
Define value for property 'package' org.apache.nifi.processors.yourbundle.processors.yourbundle : : org.apache.nifi.processors.yourbundle 

8) Open folder in IntelliJ
9) To test  go to test/java/MyProcessorTest right click and “Run my ProcessorTest”
10) On the right side, there should be a tab called Mavern Projects
11) Find “nifi-yourbundle-bundle” (not -nar/-processors)
12) The install button will make the .nar file
13) Move the .nar file from /Documents/Nifi-Development\nifi-yourbundle-bundle\nifi-yourbundle-nar\target to /Documents/NiFi/lib
14) Restart NiFi
15) Your processor will now be in the processors selection

No comments:

Post a Comment