Setu-TS
    Preparing search index...

    Class InMemoryBroker

    In-memory message broker implementation.

    Provides fanout delivery to subscribers without a queue, and load-balanced (round-robin) delivery to subscribers within a queue.

    0.1.0

    Implements

    • MessageBrokerAdapter
    Index
    • Publishes a message to a topic.

      Delivers to all subscribers without a queue (fanout), and to one subscriber per queue (round-robin load balancing).

      Type Parameters

      • T

        The message payload type

      Parameters

      • topic: string

        The topic to publish to

      • message: T

        The message payload

      • Optionaloptions: PublishOptions

      Returns Promise<void>

      Resolves once every matching subscription's work item has been handed to dispatch — NOT once every handler has returned. A handler's rejection reaches the configured onDispatchError (or is observed and dropped when none is configured); it never rejects the publish and never becomes an unhandled rejection. This is the guarantee real brokers give — publish returns before delivery — so the in-memory double honours it too. Since M89c it also means one slow or throwing fan-out handler no longer delays or aborts delivery to its siblings.

      0.1.0

    • Internal

      Publishes a message with framework-owned transport headers. Resolves on dispatch hand-off (see publish); each invoked handler's promise is RETAINED and its rejection routed to the failure path below — never dropped, never unhandled.

      Type Parameters

      • T

      Parameters

      • topic: string
      • message: T
      • headers: Readonly<Record<string, string>>
      • Optionaloptions: PublishOptions

      Returns Promise<void>

    • Tri-state backend reachability (M70c).

      There is no backend to be unreachable: the bus is in-process, so the answer is simply whether the broker is running. true while ready, false before connect() or after disconnect().

      Returns Promise<boolean>

      true when the broker is running, false otherwise

      0.1.0

    • Sends a request and awaits a single correlated reply.

      Type Parameters

      • TReq

        The request payload type

      • TRes

        The reply payload type

      Parameters

      • topic: string

        Destination topic a responder is listening on

      • message: TReq

        The request payload

      • Optionaloptions: RequestOptions

        Reply timeout behavior

      Returns Promise<TRes>

      The reply payload

      0.1.0