Class CommandBus

Provide the ability to run commands either locally or on remote systems given the correct publisher.

Hierarchy

Constructors

Properties

_errorHandlers: Map<string, IMoiraeFilter<Error>>
_handlerMap: Map<string, IHandler<ICommand, unknown>>
_observableFactory: ObservableFactory
_publisher: IPublisher<IEventLike>
_sagaManager: SagaManager

Methods

  • Trigger processing of a given command in one of two ways:

    • If the current application can process the command, meaning the ICommand.$executionDomain property has been registered, the command will be processed asynchronously to the main thread as a Promise without interacting with external systems.
    • If the current application cannot process the command, the command will be enqueued for processing via a publisher for processing externally.

    In either scenario, the response from this function will contain relevant information for subscribing to events emitted by the command processing.

    Returns

    An object containing information about the acknowledged execution

    Parameters

    Returns Promise<CommandResponse>

Generated using TypeDoc