Directory Watch
The Directory Watch is able to monitor a folder and report back when a new file is present. It has several key checks in place to make sure the file isn't actively being written too, or locked by another application before executing the file ready callback.
Directory Watch expects that the file will be removed from the directory after it has been processed. For this reason there are several options on the DirectoryWatchFailurePolicy on how to handle when a file hasn't been removed.
Directory Watch is great for file processing where the file is expected to be removed.
Directory Notifier is great for supporting hot-reload at runtime.
Demo Application
This demo will:
Watch the
C:\Watch
folderIt will report on any CSV files (
*.csv
)It will search
AllDirectories
(subDirectoties) as well as it's rootThe
DirectoryWatchFailurePolicy
is set to move the file to a_Failed
folder if the file has not been moved or deleted after the callback has completed.
As a bonus, we'll read that CSV data in and report on it's load.
Dummy sample file used here:
When the above example run's against this file, it will log:
Failure Policies
At the moment, Perigee contains 3 different failure policies:
Redelivery after a certain period of time
Move to Failed Folder (_Failed)
Delete removes the file from the system.
Last updated