Hi Sally,

Glad you have found NiFi useful.

From the way you describe it, it sounds almost like you are trying to create a 
stateful flow. This can be tricky. I recommend giving MattyB's script tester a 
shot to see if you can develop your script in isolation before deploying it to 
a NiFi instance.

I'm not 100% on what you're trying to do, but yes, it does seem like 
wait/notify might help.

If, after giving MattyB's script tester a thorough try, you still are unable to 
accomplish your task, please give us a higher-level description of what you are 
attempting to do. It helps to know more about your general intent, rather than 
the specific steps you have tried which are failing. It would also help to know 
a little more about your environment, particularly if your flow involves 
multiple NiFi nodes or is just a single node.

Regards and good luck,

Andy
________________________________________
From: sally <[email protected]>
Sent: Saturday, October 28, 2017 3:51 PM
To: [email protected]
Subject: NIFI:how to transfer certain amount of flowfile

I want to get one flowFile (from success queue) to read count attribute from
it, and then i want to get count number flowfiles and put it in flowfile
List after that i will check if flowfile list size == count i will transfer
all receveied flowfiles I have tried codes like this, but this logic doesn't
work for me should i use wait/notify processor or routeonattribute
processor? can you give me any alternative idea of how can i make this task?

import org.apache.commons.io.IOUtils
import java.nio.charset.StandardCharsets

def flowFile = session.get()
if (!flowFile) return
int numb=(flowFile.getAttribute("count") as Double).round()
int  m=numb;
session.rollback();
def flowFiles = session.get(m)

if (flowFiles.size()==m){

 //transfer first and other files to success

    session.transfer(flowFiles, REL_SUCCESS)

}else{
   //rollback everything we got from incoming queue
    session.rollback()
}



--
Sent from: http://apache-nifi-users-list.2361937.n4.nabble.com/



Reply via email to