A Watcher in Gospel is a process outside of the ledger that takes an action when it sees something happen in the chain. For instance, when a purchase order request is created, it might make an outgoing API call to an external accounting system to raise the purchase order. A LedgerBridge instance might then observe that purchase order being created in the external system and update the original record. Equally, it might be desirable to send an email to a user telling them their data has been accessed when an audit log entry is observed. The WatcherSubscriber (an external Gospel application) receives information from the Watcher regarding changes in records, and then execute the specified actions for the matched conditions.

A Watcher consists of the following elements:

  1. Watcher: Defines the records to be tracked for activities. When a record is created or an existing record is modified, the watcher process is initiated.
  2. WatcherSubscriber: Which is notified about the changes from the Watcher. (How to start the WatcherSubscriber)
  3. Conditions: The WatcherSubscriber verifies if the changes meet any of the conditions defined in the watcher.
  4. Actions: The WatcherSubscriber performs the specified actions when the conditions are met.