session.get() only returns a FlowFile reference (or null if one is not available). Instead you want something like
which will return a List<FlowFile> guaranteed not to be null, but it may have size < 9 so your check should work in this case. Having said that, are you sure you want to transfer them to failure? If you're planning on just routing them back to the ExecuteScript (until 9 are available) then you could just do session.rollback() or session.transfer(flowFile, Relationship.SELF)
I'm not sure if I fully understand how your downstream flow would work when there are < 9 flow files available to ExecuteScript, but here's something to try (note that you can use anything greater than 9 in place of the "10" below):
@yamaga, as this is an older post, you would have a better chance of receiving a resolution by starting a new thread. This will also be an opportunity to provide details specific to your environment that could aid others in assisting you with a more accurate answer to your question. You can link this thread as a reference in your new post.
Vidya Sargur, Community Manager
Was your question answered? Make sure to mark the answer as the accepted solution. If you find a reply useful, say thanks by clicking on the thumbs up button. Learn more about the Cloudera Community:
What about if there are zero available? Are you scheduling this processor to run every few seconds, or the default (as fast as possible)? If the latter, you will likely want to check that there are > 0 and < 9 flow files available.
@Matt BurgessI had the similar scenario where i needed the count of flowfiles generated but the script is not working.The incoming queue is queued with the flowfiles and its not getting processed.Is it because its a clustered nifi.Can you please help?