Support Questions
Find answers, ask questions, and share your expertise

Conditionally choose and trigger(start-stop) or enable-disable ProcessGroups

New Contributor

Hi have multiple process groups for Data Extractions (one processgroup for Oracle, one for MySQL) which are converted to csv and later are fed to a big data processing engine as source files. 

 

I want to implement a condition trigger by reading a file (which tells me Oracle or MySQL), based on the content if this file, I need to trigger the corresponding data extraction ProcessGroup.

 

Note : I dont want to do any action manually on the UI, this has to be an automated solution, which will work based on the file data which says, which ProcessGroup should be triggered (Oracle or MySQL). Both should not run at the same time.

 

How can I implement this ? Any help will be highly appreciated.

1 REPLY 1

Master Guru

@AA24 

NiFi was designed as an always on type of dataflow design.  As such the NiFi processor components support "Timer Driven" and "Cron Driven" Scheduling Strategy types.  

That being said, the ability to tell a processor to "Run Once" exists within NiFi.  You could manually do from within the UI by right clicking on the NiFi processor component and selecting "run once" from the pop-up context menu.

MattWho_0-1634670755013.png

 

The next thing to keep in mind is that anything that you can do via the UI, you can also do via a curl command.  So it is possible to build a dataflow that could trigger the "run once" api call against the processor you want to fetch from the appropriate DB.  You can not execute "run once" against a PG nor would I recommend doing so.  You want to only trigger the file responsible for ingesting your data and leave all the other processor running all the time so they process whatever data they have queued at anytime.

 

First you to create your trigger flow, so you could have a getFile to consume the trigger file and use maybe a RouteOnContent processor to send the FlowFile to either an InvokeHTTP configured to invoke run-once on your Oracle configured processor or an invokeHTTP configured to invoke run-once on your MySQL configured processor.

Using your browser's developer tools is an easy way to capture the rest-api calls that are made when you manually perform them the action via the UI.


If you found this response assisted with your query, please take a moment to login and click on "Accept as Solution" below this post.

Thank you,

Matt