Observers


On this page

    Observers are an optional element in Comunica's core architecture. They allow you to listen to all actions on a bus, without modifying the action's input our output.

    Observers (ActionObserver) require a bus parameter, which should be supplied in the config file. Your observer implementation must override the following onRun method:

    interface ActionObserver {
      onRun(
        actor: Actor<IAction, IActorTest, IActorOutput>,
        action: IAction,
        output: Promise<IActorOutput>,
      ): void;
    }

    This method allows you to see the handling actor, the executed action, and a promise to the action output.

    Click here to find an example of a full observer implementation and configuration.