Setu-TS
    Preparing search index...

    Class RabbitMqBroker

    RabbitMQ message broker implementation using AMQP 0-9-1 topic exchange.

    M70c: amqplib has no reconnect of any kind, so this broker runs the ReconnectSupervisor in drive mode — on a connection 'error'/'close' event it reconnects, re-asserts the exchange, and replays every active subscription. isReady() keeps its lifecycle meaning (a reconnecting broker is still ready); reachability() reports the fault window, which the health indicator maps to down.

    0.1.0

    Implements

    • MessageBrokerAdapter
    Index
    • Boolean port member (M70c): false only when positively unreachable.

      A probe that could not answer inside the bound reports true — "not known down" — because the port contract is boolean and the honest tri-state is what RabbitMqBroker.reachability carries. This is the ServiceBusBroker.isHealthy() shape exactly.

      Returns Promise<boolean>

      true when the broker answers the probe or could not be probed, false when it is faulted, unconnected, or refuses it

      0.1.0

    • Checks if the broker is connected (lifecycle — M70c).

      true while connect() has run and disconnect() has not, even during a reconnect window: the lifecycle is intact, the backend is what is down. Reachability is isHealthy/reachability.

      Returns boolean

      true if connected, false otherwise

      0.1.0

    • Publishes a message to a topic.

      Type Parameters

      • T

        The message payload type

      Parameters

      • topic: string

        The topic to publish to

      • message: T

        The message payload

      • Optionaloptions: PublishOptions

        Caller headers, ordering key and de-duplication id

      Returns Promise<void>

      Resolves when published

      When publishTimeoutMs expires; delivery remains possible

      0.1.0

    • Internal

      Publishes with framework-owned headers under the configured acknowledgement bound.

      Type Parameters

      • T

      Parameters

      • topic: string

        Destination topic

      • message: T

        Payload to serialize

      • headers: Readonly<Record<string, string>>

        Framework-owned transport headers

      • Optionaloptions: PublishOptions

        Caller headers, ordering key and de-duplication id

      Returns Promise<void>

      Resolves when the transport acknowledges the publish

      When publishTimeoutMs expires; delivery remains possible

    • Backend reachability (M70c; a real round trip since M95b §3.6).

      false while the supervisor is in a fault window (the connection dropped and the drive-mode reconnect has not yet succeeded) — that short-circuit performs no round trip and is read ahead of the cache — and false with no open connection. Otherwise the answer comes from RabbitMqBroker.#openThrowawayChannel, cached 5 s and bounded 2 s, resolving undefined — could not determine — for a probe that does not answer inside the bound.

      The M70c probe was Promise.resolve(!this.#supervisor.faulted) — a flag read, which a HUNG broker never trips (a paused broker keeps its socket; only a stopped one drops it), so a paused broker reported reachable: true while no AMQP handshake could complete.

      The cache and the bound live here rather than only at the health indicator, because the indicator is not the only caller: the realtime backplane's 'messaging' transport delegates to isHealthy() directly and documents that it keeps no cache of its own. Without this, a real round trip fired once per health poll and a paused broker left that caller waiting on a promise that never settled.

      One bounded-window cost is named rather than hidden: against a PAUSED broker the channel open itself never settles, so each abandoned poll leaves one pending open that the finally cannot yet run for; the pending opens settle and close on recovery (or with the connection at disconnect()), and amqplib buffers them, so the window is transient rather than a leak. The 5 s cache also bounds how many such pending opens a polling endpoint can accumulate.

      Returns Promise<boolean | undefined>

      true when the broker answers a channel open, false when it is faulted, unconnected, or refuses the round trip, undefined when the round trip did not answer inside the bound

      0.1.0