Support Questions

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

Execute an action on NiFi startup

avatar

What is the best way to execute a one-time action during a NiFi startup? E.g. call home and report the (floating) IP address of the instance, or update a registry, etc.

Contrary to a reporting task, the idea is to fire once, not be running continuously while NiFi is up and have no requirement to be configured by a user explicitly (other than an admin deploying the code).

1 ACCEPTED SOLUTION

avatar
Expert Contributor
@Andrew Grande

NiFi supports the notion of Bootstrap Notification Services. These services can be configured to run when NiFi is Started, when NiFi is stopped, or when NiFi unexpected dies (or any combination of those). Currently, the only implementation that exists is the E-Mail Notification Service, but others could certainly be developed. These are configured in the conf/bootstrap.conf file and associated conf/boostrap-notification-services.xml file.

View solution in original post

3 REPLIES 3

avatar
Expert Contributor
@Andrew Grande

NiFi supports the notion of Bootstrap Notification Services. These services can be configured to run when NiFi is Started, when NiFi is stopped, or when NiFi unexpected dies (or any combination of those). Currently, the only implementation that exists is the E-Mail Notification Service, but others could certainly be developed. These are configured in the conf/bootstrap.conf file and associated conf/boostrap-notification-services.xml file.

avatar

Thanks @mpayne , this worked quite well for Started and Stopped events. I had a question on DIED notification, however. What logic does it use to detect this event? E.g. if I killed a child NiFi process, the bootstrap log simply has 'NiFi never started entry added', whereas I expected something else.

avatar
Expert Contributor

When you start NiFi, the bootstrap process is constantly monitoring the NiFi process. If it notices that the NiFi process doesn't exist anymore, it will produce a NIFI_DIED notification and then restart NiFi.