Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Faster way of developing and Testing new Nifi Processor

Tags:

apache-nifi

I am developing new Nifi processor for my data flow. I make code changes in eclipse , creates new .nar file and copy it to Nifi lib for testing it.

On ever nar update Nifi needs a restart which takes a significant amount of time.

Is there any better way of testing your new .nar in Nifi ? Because restarting Nifi for every small change reduces your development speed.

like image 870
Shashi Avatar asked Jun 25 '17 16:06

Shashi


People also ask

How do I start my NiFi processor?

To run NiFi in the background, instead run bin/nifi.sh start . This will initiate the application to begin running. To check the status and see if NiFi is currently running, execute the command bin/nifi.sh status . NiFi can be shutdown by executing the command bin/nifi.sh stop .

How do I check my NiFi performance?

For performance, you should be able to get a good idea of the performance by looking at the various statistics in NiFI, there are stats on each processor, process groups, and from the global menu Summary page, they all show things like FlowFiles in/out and bytes in/out.

How many NiFi processors are there?

Includes all processors through release With new releases of Nifi, the number of processors have increased from the original 53 to 154 to what we currently have today! Here is a list of all processors, listed alphabetically, that are currently in Apache Nifi as of the most recent release.


2 Answers

There are a few options for rapid prototyping and testing that make developing Apache NiFi processors easier.

  1. Model your code in ExecuteScript -- using the ExecuteScript processor means you can make code changes to the domain-related code (whatever you type into the processor Script Body property or a file referenced by Script File) without having to build anything or restart the application. You can replay the same flowfiles through the updated code using the provenance replay feature. You can also test your scripts directly with Matt Burgess' NiFi Script Tester tool. Once you have acceptable behavior, take the script body and migrate it to a custom processor that can be deployed.
  2. Use the unit testing and integration testing features of NiFi -- the test harnesses and "runners" provided by the core framework will allow you to simulate flow scenarios in automated tests before deploying the entire application. It takes a little time to build out the first flow, but once you do, it's a repeatable and understandable process which you can use to cover edge cases and ensure desired behavior.
like image 138
Andy Avatar answered Oct 16 '22 14:10

Andy


Just check how testing done for standard nifi processors. And do the same. For example look at dbcp https://github.com/apache/nifi/tree/master/nifi-nar-bundles/nifi-standard-services/nifi-dbcp-service-bundle/nifi-dbcp-service/src

For those tests you don't need to start nifi.

like image 5
daggett Avatar answered Oct 16 '22 14:10

daggett