class RabbitMqBroker
implements MessageBrokerAdapter
Since 0.1.0

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.

Constructors

RabbitMqBroker(
runtime: IRuntimeServices,
serializer: ISerializer,
options?: RabbitMqOptions
)

Creates a new RabbitMQ broker.

Parameters
runtime: IRuntimeServices

Runtime services for uuid, timestamps, and timers

serializer: ISerializer

Serializer for message payloads

optional
options: RabbitMqOptions

RabbitMQ connection and configuration options

Methods

Since 0.1.0
connect(): Promise<void>

Connects to RabbitMQ.

Since 0.1.0
disconnect(): Promise<void>

Disconnects from RabbitMQ.

Since 0.1.0
isHealthy(): Promise<boolean>

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

Since 0.1.0
isReady(): boolean

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.

Since 0.1.0
publish<T>(
topic: string,
message: T
): Promise<void>

Publishes a message to a topic.

publishWithHeaders<T>(
topic: string,
message: T,
headers: Readonly<Record<string, string>>
): Promise<void>

Publishes a message with framework-owned transport headers. @internal

Since 0.1.0
reachability(): Promise<boolean>

Tri-state backend reachability (M70c).

false while the supervisor is in a fault window (the connection dropped and the drive-mode reconnect has not yet succeeded); true otherwise. This reads the fault flag directly — it is a zero-cost, always-current value, so caching it (as the I/O probes do) would make the signal stale exactly when it matters.

Since 0.1.0
request<TReq, TRes>(
topic: string,
message: TReq,
options?: RequestOptions
): Promise<TRes>

Sends a request and awaits a single correlated reply.

requestWithHeaders<TReq, TRes>(
topic: string,
message: TReq,
headers: Readonly<Record<string, string>>,
options?: RequestOptions
): Promise<TRes>

Sends request-reply traffic with framework-owned headers. @internal

Since 0.1.0
respond<TReq, TRes>(
topic: string,
handler: RequestHandler<TReq, TRes>,
): Promise<ISubscription>

Registers a responder whose result is returned to the requesting caller.

Since 0.1.0
subscribe<T>(
topic: string,
handler: MessageHandler<T>,
): Promise<ISubscription>

Subscribes to a topic.

subscribeWithHeaders<T>(
topic: string,
handler: MessageHandler<T>,
): Promise<ISubscription>

Subscribes through the header-aware internal path. @internal