I’ve done this with a combination of a ScheduledRoutePolicy (to start the route when I want to start reading the directory) and a call to the control bus when all the files have been processed. I use the “sendEmptyMessageWhenIdle” option on the file component to detect when it’s done.
HTH > On May 8, 2017, at 8:49 AM, Jonathan Schoreels <jonathan.schore...@gmail.com> > wrote: > > Hi. > > I would like to know, in your experience, what's the best way to poll an > entire folder/remote folder, at an regular interval ? > > It could seems quite easy, since the the file consumer can be used as a > batch consumer, that a scheduler can be used with it, but I have some > limitation each time : > > 1. Batch consumer : How to set a "good maxMessagePerPoll" ? If I hardcode > it, and poll those messages each day, I'm not future proof if more file > comes. > 2. poll enrich only poll one at a time. So if I need to poll ALL the folder > each day, it doesn't help me. > 3. having to start/stop routes with controle bus seems lot of > tweaks/hacking just to design a simple flow. > > Have you any suggestion ? > > Jonathan