FME Flow: 2024.2

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.

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

Configuring the Publisher

  1. In the FME Flow 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 Flow Core service must have Read/Write (Windows) or Read (Linux) permission on any directories that are not managed as FME Flow 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, 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.
  10. Note  Events trigger based on changes in file date. If a file is overwritten, 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 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"

}