Support Questions

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

Nifi:Manipulatig Cron Scheduling

avatar
Contributor

I want to manipulate cron schedule attribute so that it should start processor in 2 hours after it gets flowfile from previous nifi processor is there any way i can do it by simple coding or i will have to write nifi processor myself?( if so can you give me any advice how can i write nifi invokehttp

processor myself )

1 ACCEPTED SOLUTION

avatar
Super Mentor
@sally sally

You could use an UpdateAttribute and RouteOnAttribute processor to delay FlowFiles by two minutes before passing them to your next processor instead.

34767-screen-shot-2017-09-12-at-92302-am.png

The UpdateAttribute processor is used to create a new attribute with a value of the current epoch time in Milliseconds

currentTime = ${now():toNumber()}

The RouteOnAttribute then adds 2 minutes to that attribute and checks to see if it os less then or equal to the current time. If it is less then, your FlowFiles are sent to the unmatched Relationship which is looped back on the processor. The FlowFiles will continue to loop until 2 minutes have past at which time they will be routed to the matched (2mins) relationship created using teh following:

2mins = ${currentTime:plus(120000):le(${now()})}

Thanks,

Matt

View solution in original post

4 REPLIES 4

avatar
Super Mentor
@sally sally

You could use an UpdateAttribute and RouteOnAttribute processor to delay FlowFiles by two minutes before passing them to your next processor instead.

34767-screen-shot-2017-09-12-at-92302-am.png

The UpdateAttribute processor is used to create a new attribute with a value of the current epoch time in Milliseconds

currentTime = ${now():toNumber()}

The RouteOnAttribute then adds 2 minutes to that attribute and checks to see if it os less then or equal to the current time. If it is less then, your FlowFiles are sent to the unmatched Relationship which is looped back on the processor. The FlowFiles will continue to loop until 2 minutes have past at which time they will be routed to the matched (2mins) relationship created using teh following:

2mins = ${currentTime:plus(120000):le(${now()})}

Thanks,

Matt

avatar
Contributor

can i deley flowfiles by two hour if i replace 120000 by 7200000

avatar
Super Mentor

@sally sally

That is correct, adding 7,200,000 ms will increase your delay to 2 hours.

If you found my answer addressed your question, please mark it as the accepted answer by clicking

34778-screen-shot-2017-09-12-at-100608-am.png

Thanks,

Matt

avatar
Contributor

Thank you it was helpfull