How to Implement a File Watcher Solution Using the appRules WatchFileSystem Activity

Many integration projects require monitoring of a directory on the file system for changes.  When a new file is added to a location or changes made to the location, the file system notification is utilized to process the file or to perform some other actions.

The system of watching a location on the file system is known as a “File Watcher System” or “File Drop System”.  appRules supports the quick implementation of a File Watcher Solution by utilizing the WatchFileSystem activity of the appConnector File System module.  You can specify the directory to monitor and when a file event occurs, you can directly launch a job or run a function to process the file or perform other actions.

The WatchFileSystem Activity

The WatchFileSystem activity can be used to monitor a directory for changes and to perform actions based on changes to the files in the directory.

To use the WatchFileSystem activity in your project, drag and drop it on to the designer.

Click on the FileWatcherDefinition property button and the following window will be displayed:

Follow the on-screen instructions and configure the properties as follows:

Property Description
Directory Enter or configure the directory path to be monitored.
Include Subdirectories Check this box to monitor subdirectories.
Filter Specify the file type to monitor e.g.  *.txt
On File System Event Action Select the action to perform when a file event occurs.

None:        No special action – continue processing

Run Custom Function:  Runs a custom function

Run Workflow:   Launches a new job to process the file

 

Conclusion

The WatchFileSystem activity is a powerful tool that can be used to quickly implement a powerful file watcher solution without writing code.

You can download appRules with sample projects at: http://www.appstrategy.com/appRulesTrial

Author: appStrategy Team

appStrategy Support Team blog