A mediator can mediate an action over a bus of actors.

It does the following:

  1. Accepts an action in Mediator#mediate.
  2. Sends the action to the bus to test its applicability on all actors.
  3. It mediates over these test results.
  4. It selects the best actor.
  5. The action is run by the best actor, and the result if returned.

The mediates and best parts are filled in by subclasses of this abstract Mediator class.

Hierarchy (View Summary)

Constructors

Properties

bus: Bus<
    Actor<
        IActionFunctionFactory,
        IActorTest,
        IActorFunctionFactoryOutput,
        undefined,
    >,
    IActionFunctionFactory,
    IActorTest,
    IActorFunctionFactoryOutput,
    undefined,
>

The bus this mediator will mediate over.

mediate: <T extends IActionFunctionFactory>(
    action: T,
) => Promise<
    T extends { requireTermExpression: true }
        ? IActorFunctionFactoryOutputTerm
        : IActorFunctionFactoryOutput,
>

Mediate for the given action.

This will send the test action on all actors in the bus. The action will be run on the actor that tests best, of which the result will be returned.

Type declaration

name: string

The name for this mediator.

{<rdf:subject>}

Methods