Created 09-12-2017 11:56 AM
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 )
Created on 09-12-2017 01:28 PM - edited 08-18-2019 01:14 AM
You could use an UpdateAttribute and RouteOnAttribute processor to delay FlowFiles by two minutes before passing them to your next processor instead.
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
Created on 09-12-2017 01:28 PM - edited 08-18-2019 01:14 AM
You could use an UpdateAttribute and RouteOnAttribute processor to delay FlowFiles by two minutes before passing them to your next processor instead.
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
Created 09-12-2017 02:01 PM
can i deley flowfiles by two hour if i replace 120000 by 7200000
Created on 09-12-2017 02:06 PM - edited 08-18-2019 01:14 AM
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
Thanks,
Matt
Created 09-12-2017 04:08 PM
Thank you it was helpfull