How to make a Nifi processors event driven

688 Views Asked by At

For example, if there is a pipeline made of 3 processors P1, P2, P3. When P2 produces an output flowfile, then after exactly 5 minutes I want processor P3 to work.

I cant use a fixed CRON job because the P2 processor can run at anytime.

Nifi version - 1.9.1

1

There are 1 best solutions below

2
On BEST ANSWER

Look at RetryFlowFile with Maximum Retries = 1 to put between P2 and P3.

It could penalize flow file on retries exceed. It should do it instantly with max retries =1.

Then set penalize duration to 5min.

All set. P3 should not take flow file from queue during 5 min.


option 2

you could use ExecuteGroovyScript in place of retryflowfile with following script to penalize everything that is going through it.

def ff = session.get()
if( !ff ) return
ff = session.penalize(ff)
REL_SUCCESS << ff

ps: don't forget to set penalty duration for this processor