Harnessing the power of Verity, ColdFusion event gateways, and Flex 2 – Part 1: Setting up the collection and event gateway
Setting up the event gateway
Start out by creating two files that the event gateway needs: a configuration file and a simple ColdFusion component:
- Create a directory at C:/verityRefresh.
-
Open Notepad or any text editor and enter the following code:
directory=c:/Inetpub/wwwroot/adobeArticles
recurse=yes
extensions=doc, pdf
interval=10000
addFunction=refreshVerity
changeFunction=refreshVerity
deleteFunction=refreshverity
- Save the file as documentListener.cfg and place it in the c:/verityRefresh folder.
You may wonder what you just set up. Here is a brief explanation:
- directory=c:/Inetpub/wwwroot/adobeArticles: Directory that watches for file changes; you may change this location to match your directory's location
- recurse=yes: Attribute that monitors subdirectories
- extensions=doc,pdf: Comma-delimited list of file extensions to monitor
- interval=10000: Attribute specifying how often to check for changes, in milliseconds
- addFunction=refreshVerity: Name of the function called when a file is added; default value is
onAdd
- changeFunction=refreshVerity: Name of the function called when a file is changed; default value is
onChange
- deleteFunction=refreshVerity: Name of the function called when a file is deleted; default value is
onDelete
Note: If you have DirectoryWatcher checking a large directory of files for changes too often, this may cause extra overhead and performance strain for your server. Change the interval setting in your documentListener.cfg to one minute instead of every five seconds, for example. Always test these scenarios in a development environment first and adjust the settings and attributes that work best for your setup before deploying to a production environment.