Introduction

Users can implement Directory Watching from jobs.

  • Jobs running in JS7 Agents can be used to watch for changes to directories.
  • For each change an event is raised to trigger an action.
  • Users are in charge of (re)moving files from the watched directories.

File and Directory Watching

There is a fundamental difference between both concepts:

  • File Watching is about watching for incoming files from a directory.
  • Directory Watching is about watching for changes to a directory.
    • Changes include the situation when a file or sub-directory is added, changed, renamed or deleted.
    • For each change an event is raised that can be used to trigger actions.
    • Directory Watching is performed by tools and frameworks close to the Operating System such as iNotify, Java and .Net.

Directory Watching

Changes

Directory Watching is performed for changes to a directory including

  • changes to files such as being added, changed, renamed or deleted.
  • changes to sub-directories such as being added, changed, renamed or deleted.

Events

Each change will raise an event that can be used to trigger actions such as to move files, to add orders to JS7 etc.

It is up to the user's job implementation to decide about the action to be taken for such events. 

Caveats

Event Flooding

A single file can raise any number of events, for example while the file is being written to. Each change to a file will raise an event.

Similarly if hundreds of files are added to a directory then the same number of events will be created.

Steady State Checks

For incoming files the change events are immediately raised when they are added to the directory. Events do not wait for files being completely written. It's the users' concern to implement jobs that include to check if a file is stable.

Such steady state checks typically are implemented by checking the file size in intervals of a few seconds assuming that a file that has not been changed during the last interval can be considered stable.

Resources