Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to debug apache nifi custom processor?

I am able to remote debug apache nifi custom processor in eclipse (ref:1,2,3). The steps I follow are something like this:

  1. Uncomment below line in apache nifi bootstrap.conf

    java.arg.debug=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8000
    
  2. Start apache nifi

  3. Create new debug configuration in eclipse with host=localhost,port=8000 and select custom processor's project.

So I am able to hover the variables, add watch and do step through etc. However, once I get some hint and want to change some code and quickly try, what can be done? Do I need to change code, rebuild nar, stop apache nifi, put nar in apache nifi lib and then restart apache nifi. Do I have to follow this long path every time I do some code changes? Or I am missing something? I tried by changing code and saving it. But the moment I do Ctrl+S, it shows me unable to hot swap code changes screen:

enter image description here

like image 625
Mahesha999 Avatar asked Oct 30 '25 11:10

Mahesha999


1 Answers

Yes, we can debug Custom Nifi Processor. Code your custom processor with any code editor, create nar file and copy that nar file to lib directory where your NiFi set-up is there.

Go to the conf directory inside your NiFi set-up and search for the file bootstrap.conf.

Open bootstrap.conf file in any available editor and uncomment the below line

java.arg.debug=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8000

Your can change the port availability as per your system.

Now move into your code editor(IntelliJ here) and open the drop down 'Edit Run/Debug Configurations dialog' on the top right side beside the hammer symbol.

Click on Edit configurations option

Below windows open up

enter image description here

Click on plus sign(+) on top left, a drop down will appear, select the remote

enter image description here

Below screen appears

enter image description here

Configure your port that you have mentioned in bootstrap.conf file in NiFi, suppose we have configured 8000 then we need to change the port to 8000

enter image description here

click on Apply and then OK button

Now place the debug points on the custom class that you have written and then click on debug icon on Nifi on the top right side

enter image description here

You will see the console like below

enter image description here

Now open your Nifi on browser of your choice and then start your custom processor (on browser) and then as soon as your processor starts running, debug point on the IntelliJ will hit and you can start debugging your custom processor

like image 151
Dipesh Yadav Avatar answered Nov 01 '25 02:11

Dipesh Yadav