Controlling the order in which files get processed
- by [email protected]
The File/Ftp Adapter allows you to control the order in which files get processed. For example, you might want the files to be processed in order of their modified times/ file sizes etc.
Luckily, the File/Ftp adapters allow you to achieve this via a "FileSorter" attribute that you can define in the JCA file for your inbound File/Ftp Adapter service.
The File/Ftp Adapters ship with two predefined sorters that use the last modified times e.g.
However, there are times when you would like to define the order yourself. In situations like this, you can implement a Java Comparator and register the comparator with the File Adapter as described below:
1) Write a comparator. For example, the FileSizeSorter comparator sorts the files in descending order of their sizes:
2) In order to compile this class though, you will need fileAdapter.jar in the classpath.