Support Questions

Find answers, ask questions, and share your expertise

Nifi : Implement Sleep Mechanism in nifi without Executescript

avatar

Hi Team,

I am trying to implement for the scenario where the events should sleep for 5 minutes and let all the flow files are queued up, then check the count of the files if it is greater than 10 route to failure else route to SUCCESS.

I did in Execute script processor as below. However, i am trying to avoid the executescript for this and try to use Native nifi processors.

====== Executescript ===============

Thread.sleep(300000)
def flowFiles = session.get(100)
if (!flowFiles || flowFiles.size() <= 10) {
session.transfer(flowFiles, REL_SUCCESS)
} else {
session.transfer(flowFiles, REL_FAILURE)
}

 

 

1 REPLY 1

avatar
Master Mentor

@rajivswe_2k7 

What is the use case for wanting to hold downstream processing of FlowFiles until a min 10 are queued?  This is not a typical use pattern for NiFi.  While I am sure it could be done without using a scripting processor,I don't think it would be as efficient in terms of resources.

Creative use of the MergeContent processor comes to mind here.

Please help our community thrive. If you found any of the suggestions/solutions provided helped you with solving your issue or answering your question, please take a moment to login and click "Accept as Solution" on one or more of them that helped.

Thank you,
Matt