Stone.js API
    Preparing search index...

    Multi-connection event bus.

    Publishes to one or more target connections (emit(name, payload, { targets: ['local','cloud'] })), so the same domain code reaches in-process listeners in a monolith and a cloud bus when distributed. A process-wide default instance lets adapters (the listener side) reach it without wiring.

    Implements

    Index
    • Parameters

      • defaultConnection: string = LOCAL

        The default connection name.

      • defaultTargets: string[] = ...

        The default emit targets.

      Returns EventBusManager

    • Resolve a connection by name (defaults to the default connection).

      Parameters

      • Optionalname: string

        The connection name.

      Returns EventBusConnection

      The resolved connection.

      When no connection/factory is registered under the name.

    • Type Parameters

      • T = unknown

      Parameters

      Returns Promise<void>

    • Whether a connection (instance or factory) is registered under the name.

      Parameters

      • name: string

        The connection name.

      Returns boolean

      True if registered.

    • Register a ready-made connection.

      Parameters

      Returns this

      This manager for chaining.

    • Register a lazy factory for a connection (built on first access).

      Parameters

      • name: string

        The connection name.

      • factory: ConnectionThunk

        The connection factory.

      Returns this

      This manager for chaining.

    • Set the default connection name.

      Parameters

      • name: string

        The connection name.

      Returns this

      This manager for chaining.

    • Set the default emit targets.

      Parameters

      • targets: string[]

        The target connection names.

      Returns this

      This manager for chaining.

    • Create an EventBusManager.

      Parameters

      • defaultConnection: string = LOCAL

        The default connection name.

      • defaultTargets: string[] = ...

        The default emit targets.

      Returns EventBusManager

      A new manager.

    • Register (or replace) the process-wide default manager.

      Parameters

      Returns void