Reputation: 15
I have two flow flies and i want to read those two flow files in to groovy script and i am using the below line in my groovy to read the flow file content, but how do i know which flow file i am reading here, actually i want to compare two flow file content line by line in groovy and if the content is different then only i need to send the different content into output flow file from groovy script, Thank you.
def flowFile = session.get()
if(!flowFile) return
how do know from the above which flow file i am reading out of my two incoming flow files.
Upvotes: 0
Views: 213
Reputation: 28564
In groovy processor this code session.get()
returns first function from inbound queue.
The order (priority) of files in queue defined by it's properties:
https://nifi.apache.org/docs/nifi-docs/html/user-guide.html#settings
To read first 2 files from queue you can use an int parameter in session get:
def flowFileList = session.get(2)
if(!flowFileList) return
if(flowFileList.size()<2) {
session.rollback() // return files back
return
}
...
Upvotes: 0