You are here: Reference Manual > FME Server Web Services > Notification Service > Publishers > Directory Watch Publisher

Directory Watch Publisher

The Directory Watch publisher monitors activity on a Resources folder or other location, and publishes messages about that activity to FME Server topics. Activity can include adding, changing, and deleting files and folders.

Note: You cannot monitor an Amazon Web Services (AWS) S3 bucket with the Directory Watch publisher.

Configuring the Publisher

  1. In the FME Server Web User Interface, select Notifications > Publications, and click New.
  2. Provide a name for the Publication
  3. Protocol: Select Directory Watch.
  4. Specify the Topics you want to publish to using the drop-down selector. To create a topic and use it right away, click +.

  5. 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.
  6. Note: The user account that runs the FME Server Core service must have Read/Write (Windows) or Read (Linux) permission on any directories that are not managed as FME Server Resources. See here for information about adding directories as Resources.

  7. 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.
  8. Receive Notification for Folders: If Yes, the publisher monitors activities on both files and folders. If No, the publisher monitors activities on files only.
  9. Filter: By default, the publisher monitors all actions on the specified directory, including adding (CREATE), changing (MODIFY), and deleting (DELETE) files (and folders, if applicable). 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.
  10. Note: Events trigger based on changes in file name and size. No notification is triggered if a change to an existing file does not change file size, or if a file is overwritten with one of the same size. If a file is overwritten with one of a different size, a MODIFY event is triggered.

  11. Poll Interval: How often, in minutes, to poll the specified Directory to Watch for activity.
  12. Click OK.

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"

}