class GcpPubSubBroker
implements MessageBrokerAdapter
Since 0.1.0

GCP Pub/Sub message broker.

Constructors

GcpPubSubBroker(
runtime: IRuntimeServices,
serializer: ISerializer,
options?: PubSubOptions
)

Methods

connect(): Promise<void>

Opens the broker connection.

disconnect(): Promise<void>

Closes the broker connection.

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 and ready (lifecycle).

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 | undefined>

Tri-state backend reachability (M70c).

The GCP SDK owns streaming-pull reconnection, so the broker issues no reconnect loop of its own; the probe delegates to the transport's isHealthy?() (the real adapter calls the SDK's topic.exists()). true/false from the transport, undefined when the transport omits the member (a minimal fake) — the indicator then reports reachable: 'unknown'.

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

Sends a request to a topic and awaits a single correlated reply, providing brokered request-reply (RPC) over the message broker.

A responder registered with respond on the same topic returns the reply. The call rejects with a RequestTimeoutError when no reply arrives within options.timeoutMs, and with a RemoteHandlerError when the responder throws.

Request traffic rides a channel derived from topic, disjoint from plain publish/subscribe on that same topic — a pub/sub consumer never observes an RPC request, and vice versa.

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

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

Registers a responder for a request topic. The handler's resolved value is sent back to the requesting caller, correlated to the originating request.

Pass options.queue to load-balance requests across competing responders.

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