The fs-provider provides a mechanism to filter out files (java.io.FileFilter), but not to ordering the files. Files are read in the order that java.io.File.listFiles(filter) presents, which according to the JavaDoc guarantees no specific ordering method.
I think you could probably work around this. If you extend AbstractFileGateway you can define how getFileList() works - basically if all you want to do is add ordering, you could copy the entirety of FileGatewayListener.java and just change the filterFiles method to give yourself some file ordering. You would also have to change FsListenerMapper.java to recognize your new file gateway (or provide your own mapping).
You could also work around the whole problem by providing a staging directory with cron scripts to move small numbers of files into the file gateway listener directory, depending on how many files are in there at the current time.
Have you had a chance to implement your own FileGatwayListener as Tom suggested. Could you please share your thoughts on how your approach was to override and configure it to use this new custom class ?
I am in similar situation as I have to filter files based on the filename, I am refraining from using external cron job at this point if it can be solved inside ESB.
There isn't a way to solve this inside of the ESB, other than to change the code to filterFiles() like I cited above. You could do this through AOP if you wanted, if you didn't want to alter any ESB code.
Thanks Tom for the reply. Can you please guide me what will be the approach for AOP ? never worked on that.
Appreciate your help