Support Questions

Find answers, ask questions, and share your expertise
Celebrating as our community reaches 100,000 members! Thank you!

How to execute a java class during nifi bootup ?

Master Collaborator

Hello Experts,


I need to execute java class or a java method during Nifi bootup.

This is to register/integrate my org health check sdk (which has to be done at nifi bootup time)


Is there any option to invoke/execute my java code snippet or a java class during bootup ?
Any suggestion would be appreciated.

One option I have is to write a custom logback appender class and add that custom appender is logback.xml so nifi will run this during bootup.
I am looking for better option.





Master Collaborator

@MattWho @araujo @smdas  Just tagging top solution authors to notify

Super Mentor


This is not something I have tried before, but...
When you execute the script to start it bootstrap the NiFi process via the configuration in the bootstrap.conf NiFi configuration file.  It is during the bootstrap process that NiFi starts the main child process that loads NiFi.  Perhaps you can add additional java.args to handle your pre NiFi needs?  

Or maybe modify the the script itself so that is executes your requirements before calling the rest of the NiFi startup process. 

If you found that the provided solution(s) assisted you with your query, please take a moment to login and click Accept as Solution below each response that helped.

Thank you,