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

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

  1. In the FME Server Web User Interface, select Manage > Notifications. Select the Publications tab and click New.
  2. Provide a name for the Publication
  3. 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.
  4. Protocol: Select Directory Watch.
  5. 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.
  6. 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.

  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.
  8. 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.
  9. Note: If CREATE is specified, and a folder of files is added into a directory being watched, the Directory Watch publisher generates only one notification. The publisher does not generate separate notifications for each file of a folder that is added.

    MODIFY events are based on changes in file size. If a MODIFY event does not change file size, no notification is sent.

  10. Poll Interval: How often, in minutes, to poll the specified Directory to Watch for activity.
  11. When configuring Poll Interval, keep in mind the following:

    • The Directory Watch publisher does not send notifications until both of the following are true:
      • A CREATE, MODIFY, or DELETE action completes.
      • An additional poll interval period passes after completion.
    • Activity that happens within a single poll interval does not trigger a notification. A CREATE and MODIFY action on the same file between intervals triggers only a CREATE notification. A CREATE, MODIFY, and DELETE action on the same file between intervals triggers no notification.

    If notifications on frequent activity are crucial, consider specifying a shorter Poll Interval period.

  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"

}