I don't think there is a built in processor for this, as ListFile and GetFile do not take inputs. A common pattern is to copy the files to the directory, prepending them with a period (so ListFile won't notice them). Then in your external process when you would've created a _success file, instead you could rename the files to remove the period, then ListFile/GetFile will pick them up.
If that is not feasible, then you could use ExecuteScript after ListFile, it would check for the existence of your "trigger file", in this case _success. In the meantime ListFile would be running and the names of each file (except _success) from that directory would be queueing up at ExecuteScript (since they were not transferred). Once the file exists, ExecuteScript could transfer all the incoming flow files to success, where a FetchFile could be waiting to pick them up and move them. Here's an example script in Groovy: if(!new File(fileExists.value).exists()) return session.transfer(session.get(batchSize.asInteger()), REL_SUCCESS) I added two dynamic properties to ExecuteScript (batchSize and fileExists) to specify how many flow files to process at once (once the file specified by fileExists is there). I put up a template as a Gist [1], it has the regex to ignore the _success file in ListFile and the aforementioned Groovy script and dynamic properties Note that as long as the trigger file is present, ExecuteScript will continue to transfer any existing files. So if you want to create a new batch, you'd want to remove the trigger file. Then files can be copied into the source directory again, and will queue up until the trigger file exists. Also, depending on how many files can be in that directory before the trigger file exists, you may want to increase your backpressure settings for the connection between ListFile and ExecuteScript. If too many flow files are queued, backpressure will be applied and ListFile will no longer be scheduled during this time. That might not be a bad thing since once the trigger file exists, the queue will drain and the remaining files will be picked up. Regards, Matt [1] https://gist.github.com/mattyb149/c2890dd17ad1ba21199718f6eea88279 On Sun, Dec 11, 2016 at 11:33 PM, vivek b <[email protected]> wrote: > Hi, > > I have a scenario to move files only when there is a _success file in the > directory. I see there is a ExecuteScript processor for custom > implementation. > > Is there any in built processor available for this scenario? > > Thanks, > Vivek
