Created on 07-03-2017 10:39 PM - edited 08-17-2019 05:12 PM
drawing-1.jpegHi, I have a requirement to to wait one processor upto another processor complets its task
1.Let say I have a json array ,which contains the 6 json objects, i am splitting the json array so then i have 6 flowfiles
2.These 6 flowfiles one by one sending to the invokeHttp processor and get the 6 responses .Here i need to check the last response if its success then i need to start the another processor
3.I have attached the diagram representation ,please find.
In Nifiprocessor box which one i should use.Could you please provide the solution ?
Thanks
Created on 07-04-2017 08:19 PM - edited 08-17-2019 05:12 PM
You could the RouteOnAttribute processor. The SplitJson processor writes two attributes to each flow file that can be used to know when the last split flow file reaches the RouteOnAttribute file. fragment.count = The number of split FlowFiles generated from the parent FlowFile and fragment.index = A one-up number that indicates the ordering of the split FlowFiles that were created from a single parent FlowFile (this value starts at 0 for the first flow file) , so in your case, the last flow file would have fragment.index value of 5. So, you could use the expression language to determine when the last flow file arrived to the RouteOnAttribute processor.
Here is an example of how you would use the fragment.count and the fragment.index attributes:
Any flow file where the values result in a false will be routed out the unmatched relationship. The one flow file where the result will be true is routed out the nextprocessor relationship.
Created 07-06-2017 05:26 AM
Thank You Wynner for ur response. i will try
Created on 07-05-2017 06:32 AM - edited 08-17-2019 05:12 PM
Why not use the wait and notify processor?
Redirect the original file to wait processor from the splitJson processor.
In the wait processor set the Target Signal Count to ${fragment.count}.
Set the Release Signal Identifier in both the notify and wait processor to ${fragment.identifier}
Now start the flow. The SplitJson will split the flow file and redirect the original flow file to the wait processor. It will wait there until the target signal count i.e in this case fragment.count number of fragements have been notified by the notify processor.
Please try to construct a flow like below
Hope this helps
Created 07-06-2017 05:27 AM
Thank You mkalyanpur for ur response and i will try