Directory Watch Publisher
The Directory Watch publisher monitors activity on a Resource Management directory or other location, and publishes messages about that activity to FME Server topics. Activity can include adding, changing, and deleting files.
Configuring the Publisher
- In the FME Server Web User Interface, select Manage > Notifications. Select the Publications tab and click New.
- Provide a name for the Publication
- Specify the topics you want to publish to using the drop-down selector, or click Select All if you want to publish to all topics.
- Protocol: Select Directory Watch.
- To watch a Resources directory, keep focus on the Browse tab, and select a directory to watch. To watch another directory, click the Specify Location tab and enter a local file system or network (UNC) path.
- Watch Subdirectories: To watch activity in the selected directory and all subdirectories, specify Yes. To watch activity only in the selected directory and not in its subdirectories, specify No.
- Filter: By default, the Directory Watch publisher monitors all actions on the specified directory, including adding (CREATE), changing (MODIFY), and deleting (DELETE) files. To apply the publisher to only one or two of these actions, click the "x" beside the action you do not want to monitor to remove it. To add an action after removing it, click inside the dropbox and select it, or click Select All to add all actions.
- Time to Wait after MODIFY: Specifies a minimum time to elapse, in seconds, before an additional MODIFY event triggers a notification for the same file. File modifications made before the minimum time elapses are never reported. As well, each file modification that occurs before the minimum time elapses will reset the elapsed time to zero.
- Click OK.
Note: The user account that runs the FME Server Core service must have Read permission on any directories that are not managed as FME Server Resources. See here for information about adding directories as Resources.
This setting may be useful for avoiding multiple notifications when updating a large file.
This setting applies only if MODIFY is specified under Filter and Directory to Watch is not a UNC path.
Mouse-over to view screenshot:
Sample Notification Schemas
To parse the incoming JSON message from the Directory Watch publisher, use the Directory Watch Reader custom format in your FME Workbench workspace. For more information and to download the reader, visit the FME Store at fmestore.safe.com/.
When a file is deleted
{
"dirwatch_publisher_path": "C:\\apps\\FMEServer\\Temp\\sample_file.txt",
"dirwatch_publisher_content": "ENTRY_DELETE C:\\apps\\FMEServer\\Temp\\sample_file.txt",
"dirwatch_publisher_action": "DELETE",
"fns_type": "dirwatch_publisher"
}
When a file is changed (for example, added content)
{
"dirwatch_publisher_path": "C:\\apps\\FMEServer\\Temp\\sample_file.txt",
"dirwatch_publisher_content": "ENTRY_MODIFY C:\\apps\\FMEServer\\Temp\\sample_file.txt",
"dirwatch_publisher_action": "MODIFY",
"fns_type": "dirwatch_publisher"
}
When a file is added
{
"dirwatch_publisher_path": "C:\\apps\\FMEServer\\Temp\\sample_file.txt",
"dirwatch_publisher_content": "ENTRY_CREATE C:\\apps\\FMEServer\\Temp\\sample_file.txt",
"dirwatch_publisher_action": "CREATE",
"fns_type": "dirwatch_publisher"
}