Hi,
We already provide the aggregation functionality, both through annotations and through the namespace. The functionality has been there since M3, but a couple of fixes where added in M4. You can take a look at the tests provided in the distribution for configuration samples for now, but we're in the works for including the documentation for it. What you will need to do is to implement the aggregation logic itself.
But the way you are describing it, you are more interested in getting a snapshot of a given directory, so you can implement a source which simply returns the result of File.list() when called on a specific directory. I don't see a case for subclassing FileSource, what you could rather do is implement a specific Source, since the functionality in this case is much simpler (FileSource is more concerned with analyzing the content of the folder and reacting to changes - i.e. any newly added or modified file spawns a new message). As I said, you just want to get a snapshot of what is in that folder at the polling time. Instead of using <file-source>, you can just create a <bean/> with the new Source<?> and inject it into a <source-endpoint>.
If you have a single <source-endpoint> injected with a given Source, that will be thread-safe. From what I can see, your solution can be implemented with either an aggregator or a custom file adapter, depending on the case.
Good luck and let us know if you have any questions,
Marius
Marius Bogoevici,
Spring Integration Committer