May 30th, 2008, 02:29 AM
Alternate File Adapter Use Case
We have a use case want to use SI file adapter to achieve.
- FR1 Have a poller to poll on a directory for every 5 seconds
- FR2 If any file or files appeared, fire an event to registered listeners
- FR3 the event need to contain all files, instead of a single file.
- NF1 If multiple pollers are polling on the same directory, we want only poller fire the event.
- NF2 If a file is being transferred from remote system and network is slow. The file will first appear and gradually grow. We want the poller to fire event only when the file is completed transfer.
- NF3 Some remote system use a 'ready' file to achieve the NF2 requirement. We want the file adapter also support this by doing some configuration.
As the SI FileSource do not support FR3 (clarify me if I am misunderstand), we plan to write another file adapter to support the feature.
We plan the following logic:
- L1 poll on the directory and turn all listed files into a Message.
- L2 before actual returning the Message, move all listed files to another directory to avoid another poller seeing the same file set.
- L3 if the above move file actions is not success, we will give up Message and return empty result.
We will do a Poc in the above logic based on m4 release. Please advise if you spotted any critical points we missed.