Directory Watch Publisher
The Directory Watch publisher monitors activity on a Resources folder or other location, and publishes messages about that activity to FME Flow topics. Activity can include adding, changing, and deleting files and folders.
Configuring the Publisher
- In the FME Flow Web User Interface, select Notifications > Publications, and click New.
- Provide a name for the Publication
- Protocol: Select Directory Watch.
-
Specify the Topics you want to publish to using the drop-down selector. To create a topic and use it right away, click +.
- Directory to Watch: To watch a Resources directory, click the ellipsis (...), and select a directory to watch. To watch another directory, enter a local file system or network (UNC) path directly in the textbox.
- 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. This setting also applies to directories that are added into the watched directory. If No, separate notifications are not generated for files in a directory that is added.
- Receive Notification for Folders: If Yes, the publisher monitors activities on both files and folders. If No, the publisher monitors activities on files only.
- Filter: By default, all actions on the specified directory are monitored, including adding (CREATE), changing (MODIFY), and deleting (DELETE) files (and folders, if applicable). To monitor 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.
- Poll Interval: How often, in minutes, to poll the specified Directory to Watch for activity.
- Initial Action
- Notification
- DELETE actions: A notification is sent after the current poll interval elapses.
- CREATE and MODIFY actions: An additional poll interval occurs. If the action is complete after the additional poll interval, a notification is sent. Otherwise, one additional poll interval occurs, and a notification is sent, whether or not the action is complete.
- Click OK.
When an action (CREATE, MODIFY, DELETE) occurs, it enters into the current poll interval, which has partially elapsed.
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 Hub at https://hub.safe.com/.
When a file is deleted
{
"dirwatch_publisher_path": "C:\\apps\\FMEFlow\\Temp\\sample_file.txt",
"dirwatch_publisher_content": "ENTRY_DELETE C:\\apps\\FMEFlow\\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\\FMEFlow\\Temp\\sample_file.txt",
"dirwatch_publisher_content": "ENTRY_MODIFY C:\\apps\\FMEFlow\\Temp\\sample_file.txt",
"dirwatch_publisher_action": "MODIFY",
"fns_type": "dirwatch_publisher"
}
When a file is added
{
"dirwatch_publisher_path": "C:\\apps\\FMEFlow\\Temp\\sample_file.txt",
"dirwatch_publisher_content": "ENTRY_CREATE C:\\apps\\FMEFlow\\Temp\\sample_file.txt",
"dirwatch_publisher_action": "CREATE",
"fns_type": "dirwatch_publisher"
}