Example 1
Example 1
import { MessagingPlugin } from '@setu-ts/messaging-plugin'; import { CAPABILITIES } from '@setu-ts/common'; // GCP Pub/Sub app.register(MessagingPlugin({ broker: 'pubsub', projectId: 'my-project', })); // Azure Service Bus app.register(MessagingPlugin({ broker: 'service-bus', connectionString: 'Endpoint=sb://...', })); // Custom broker app.register(MessagingPlugin({ broker: 'custom', instance: myBroker, }));
Thrown when a delivery held on the ingress behaviour-chain gate
(PipelinedBroker) waits longer than the configured
chainReadyTimeoutMs (default 10 000 ms; 0 waits forever) for the
behaviour chain to open.
-
timeoutMs: number
The bound that fired, in milliseconds.
GCP Pub/Sub message broker.
-
connect(): Promise<void>
Opens the broker connection.
-
disconnect(): Promise<void>
Closes the broker connection.
-
isHealthy(): Promise<boolean>
Boolean port member (M70c):
falseonly when positively unreachable. -
isReady(): boolean
Checks if the broker is connected and ready (lifecycle).
-
publish<T>(): Promise<void>topic: string,message: T
Publishes a message to a topic.
-
publishWithHeaders<T>(): Promise<void>topic: string,message: T,headers: Readonly<Record<string, string>>
Publishes a message with framework-owned transport headers. @internal
-
reachability(): Promise<boolean | undefined>
Tri-state backend reachability (M70c).
-
request<TReq, TRes>(): Promise<TRes>topic: string,message: TReq,options?: RequestOptions
Sends a request to a topic and awaits a single correlated reply, providing brokered request-reply (RPC) over the message broker.
-
requestWithHeaders<TReq, TRes>(): Promise<TRes>topic: string,message: TReq,headers: Readonly<Record<string, string>>,options?: RequestOptions
Sends request-reply traffic with framework-owned headers. @internal
-
respond<TReq, TRes>(): Promise<ISubscription>topic: string,handler: RequestHandler<TReq, TRes>,options?: SubscribeOptions
Registers a responder for a request topic. The handler's resolved value is sent back to the requesting caller, correlated to the originating request.
-
subscribe<T>(): Promise<ISubscription>topic: string,handler: MessageHandler<T>,options?: SubscribeOptions
Subscribes to a topic.
-
subscribeWithHeaders<T>(): Promise<ISubscription>topic: string,handler: MessageHandler<T>,options?: SubscribeOptions
Subscribes through the header-aware internal path. @internal
In-memory message broker implementation.
-
connect(): Promise<void>
Connects the broker (idempotent no-op for in-memory).
-
disconnect(): Promise<void>
Disconnects the broker and clears all subscriptions.
-
isHealthy(): Promise<boolean>
Boolean port member (M70c).
-
isReady(): boolean
Checks if the broker is connected.
-
publish<T>(): Promise<void>topic: string,message: T
Publishes a message to a topic.
-
publishWithHeaders<T>(): Promise<void>topic: string,message: T,headers: Readonly<Record<string, string>>
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. @internal -
reachability(): Promise<boolean>
Tri-state backend reachability (M70c).
-
request<TReq, TRes>(): Promise<TRes>topic: string,message: TReq,options?: RequestOptions
Sends a request and awaits a single correlated reply.
-
requestWithHeaders<TReq, TRes>(): Promise<TRes>topic: string,message: TReq,headers: Readonly<Record<string, string>>,options?: RequestOptions
Sends request-reply traffic with framework-owned headers. @internal
-
respond<TReq, TRes>(): Promise<ISubscription>topic: string,handler: RequestHandler<TReq, TRes>,options?: SubscribeOptions
Registers a responder whose result is returned to the requesting caller.
-
subscribe<T>(): Promise<ISubscription>topic: string,handler: MessageHandler<T>,options?: SubscribeOptions
Subscribes to a topic.
-
subscribeWithHeaders<T>(): Promise<ISubscription>topic: string,handler: MessageHandler<T>,options?: SubscribeOptions
Subscribes through the header-aware internal path. @internal
Thrown by onIntegrationEvent's wrapper when a delivered message
is refused before the application handler runs. One class rather than four
keeps the consumer's instanceof branch a single import, while reason
discriminates.
-
expectedType: string
The
typethe consuming definition expects. -
expectedVersion: number
The
versionthe consuming definition expects. -
reason: IntegrationEventRejectionReason
Why the delivery was refused.
-
topic: string
The topic the message was consumed from.
Thrown by NatsBroker.connect when the JetStream stream could
not be ensured: the stream is absent and NatsOptions.streamSubjects was
not supplied, or the platform refused the stream read/create. The platform's
own error is carried as cause when there is one.
-
stream: string
The stream name the broker tried to ensure.
JSON serializer implementation for message payloads.
-
deserialize<T = unknown>(payload: string): T
Deserializes a JSON string to a value.
-
serialize<T>(value: T): string
Serializes a value to a JSON string.
Kafka message broker implementation.
-
connect(): Promise<void>
Connects to Kafka and creates producer.
-
disconnect(): Promise<void>
Disconnects from Kafka.
-
isHealthy(): Promise<boolean>
Boolean port member (M70c):
falseonly when positively unreachable. -
isReady(): boolean
Checks if the broker is connected.
-
publish<T>(): Promise<void>topic: string,message: T
Publishes a message to a topic.
-
publishWithHeaders<T>(): Promise<void>topic: string,message: T,headers: Readonly<Record<string, string>>
Publishes a message with framework-owned transport headers. @internal
-
reachability(): Promise<boolean | undefined>
Tri-state backend reachability (M70c).
-
request<TReq, TRes>(): Promise<TRes>topic: string,message: TReq,options?: RequestOptions
Sends a request and awaits its single correlated reply.
-
requestWithHeaders<TReq, TRes>(): Promise<TRes>topic: string,message: TReq,headers: Readonly<Record<string, string>>,options?: RequestOptions
Sends request-reply traffic with framework-owned headers. @internal
-
respond<TReq, TRes>(): Promise<ISubscription>topic: string,handler: RequestHandler<TReq, TRes>,options?: SubscribeOptions
Registers a responder for a request topic. The handler's resolved value is sent back to the caller, correlated to the originating request.
-
subscribe<T>(): Promise<ISubscription>topic: string,handler: MessageHandler<T>,options?: SubscribeOptions
Subscribes to a topic using a consumer group.
-
subscribeWithHeaders<T>(): Promise<ISubscription>topic: string,handler: MessageHandler<T>,options?: SubscribeOptions
Subscribes through the header-aware internal path. @internal
NATS JetStream message broker implementation.
-
connect(): Promise<void>
Connects to NATS and ensures the JetStream stream exists.
-
disconnect(): Promise<void>
Disconnects from NATS.
-
isHealthy(): Promise<boolean>
Boolean port member (M70c):
falseonly when positively unreachable. -
isReady(): boolean
Checks if the broker is connected.
-
publish<T>(): Promise<void>topic: string,message: T
Publishes a message to a subject (topic).
-
publishWithHeaders<T>(): Promise<void>topic: string,message: T,headers: Readonly<Record<string, string>>
Publishes a message with framework-owned transport headers. @internal
-
reachability(): Promise<boolean | undefined>
Tri-state backend reachability (M70c).
-
request<TReq, TRes>(): Promise<TRes>topic: string,message: TReq,options?: RequestOptions
Sends a request and awaits a single correlated reply.
-
requestWithHeaders<TReq, TRes>(): Promise<TRes>topic: string,message: TReq,headers: Readonly<Record<string, string>>,options?: RequestOptions
Sends request-reply traffic with framework-owned headers. @internal
-
respond<TReq, TRes>(): Promise<ISubscription>topic: string,handler: RequestHandler<TReq, TRes>,options?: SubscribeOptions
Registers a responder whose result is returned to the requesting caller.
-
subscribe<T>(): Promise<ISubscription>topic: string,handler: MessageHandler<T>,options?: SubscribeOptions
Subscribes to a topic using JetStream durable consumers.
-
subscribeWithHeaders<T>(): Promise<ISubscription>topic: string,handler: MessageHandler<T>,options?: SubscribeOptions
Subscribes through the header-aware internal path. @internal
RabbitMQ message broker implementation using AMQP 0-9-1 topic exchange.
-
connect(): Promise<void>
Connects to RabbitMQ.
-
disconnect(): Promise<void>
Disconnects from RabbitMQ.
-
isHealthy(): Promise<boolean>
Boolean port member (M70c):
falseonly when positively unreachable. -
isReady(): boolean
Checks if the broker is connected (lifecycle — M70c).
-
publish<T>(): Promise<void>topic: string,message: T
Publishes a message to a topic.
-
publishWithHeaders<T>(): Promise<void>topic: string,message: T,headers: Readonly<Record<string, string>>
Publishes a message with framework-owned transport headers. @internal
-
reachability(): Promise<boolean>
Tri-state backend reachability (M70c).
-
request<TReq, TRes>(): Promise<TRes>topic: string,message: TReq,options?: RequestOptions
Sends a request and awaits a single correlated reply.
-
requestWithHeaders<TReq, TRes>(): Promise<TRes>topic: string,message: TReq,headers: Readonly<Record<string, string>>,options?: RequestOptions
Sends request-reply traffic with framework-owned headers. @internal
-
respond<TReq, TRes>(): Promise<ISubscription>topic: string,handler: RequestHandler<TReq, TRes>,options?: SubscribeOptions
Registers a responder whose result is returned to the requesting caller.
-
subscribe<T>(): Promise<ISubscription>topic: string,handler: MessageHandler<T>,options?: SubscribeOptions
Subscribes to a topic.
-
subscribeWithHeaders<T>(): Promise<ISubscription>topic: string,handler: MessageHandler<T>,options?: SubscribeOptions
Subscribes through the header-aware internal path. @internal
Redis Streams message broker implementation.
-
connect(): Promise<void>
Connects the broker to Redis.
-
disconnect(): Promise<void>
Disconnects the broker and clears all subscriptions.
-
isHealthy(): Promise<boolean>
Boolean port member (M70c):
falseonly when positively unreachable. -
isReady(): boolean
Checks if the broker is connected.
-
publish<T>(): Promise<void>topic: string,message: T
Publishes a message to a topic (Redis stream).
-
publishWithHeaders<T>(): Promise<void>topic: string,message: T,headers: Readonly<Record<string, string>>
Publishes a message with framework-owned transport headers. @internal
-
reachability(): Promise<boolean | undefined>
Tri-state backend reachability (M70c).
-
request<TReq, TRes>(): Promise<TRes>topic: string,message: TReq,options?: RequestOptions
Sends a request and awaits a single correlated reply.
-
requestWithHeaders<TReq, TRes>(): Promise<TRes>topic: string,message: TReq,headers: Readonly<Record<string, string>>,options?: RequestOptions
Sends request-reply traffic with framework-owned headers. @internal
-
respond<TReq, TRes>(): Promise<ISubscription>topic: string,handler: RequestHandler<TReq, TRes>,options?: SubscribeOptions
Registers a responder whose result is returned to the requesting caller.
-
subscribe<T>(): Promise<ISubscription>topic: string,handler: MessageHandler<T>,options?: SubscribeOptions
Subscribes to a topic using Redis Streams consumer groups.
-
subscribeWithHeaders<T>(): Promise<ISubscription>topic: string,handler: MessageHandler<T>,options?: SubscribeOptions
Subscribes through the header-aware internal path. @internal
Thrown by IMessageBroker.request when the remote responder threw while
handling the request. The responder's error message is propagated back to the
caller in remoteMessage.
-
remoteMessage: string
The error message reported by the remote responder.
Thrown by IMessageBroker.request when no correlated reply arrives
within the configured timeoutMs window. The pending request is abandoned
and its correlation entry cleaned up; a reply that arrives afterwards is
dropped.
Azure Service Bus message broker.
-
connect(): Promise<void>
Opens the broker connection.
-
disconnect(): Promise<void>
Closes the broker connection.
-
isHealthy(): Promise<boolean>
Boolean port member (M70c):
falseonly when positively unreachable. -
isReady(): boolean
Checks if the broker is connected and ready (lifecycle).
-
publish<T>(): Promise<void>topic: string,message: T
Publishes a message to a topic.
-
publishWithHeaders<T>(): Promise<void>topic: string,message: T,headers: Readonly<Record<string, string>>
Publishes a message with framework-owned transport headers. @internal
-
reachability(): Promise<boolean | undefined>
Tri-state backend reachability (M70c, bounded in M90b).
-
request<TReq, TRes>(): Promise<TRes>topic: string,message: TReq,options?: RequestOptions
Sends a request to a topic and awaits a single correlated reply, providing brokered request-reply (RPC) over the message broker.
-
requestWithHeaders<TReq, TRes>(): Promise<TRes>topic: string,message: TReq,headers: Readonly<Record<string, string>>,options?: RequestOptions
Sends request-reply traffic with framework-owned headers. @internal
-
respond<TReq, TRes>(): Promise<ISubscription>topic: string,handler: RequestHandler<TReq, TRes>,options?: SubscribeOptions
Registers a responder for a request topic. The handler's resolved value is sent back to the requesting caller, correlated to the originating request.
-
subscribe<T>(): Promise<ISubscription>topic: string,handler: MessageHandler<T>,options?: SubscribeOptions
Subscribes to a topic.
-
subscribeWithHeaders<T>(): Promise<ISubscription>topic: string,handler: MessageHandler<T>,options?: SubscribeOptions
Subscribes through the header-aware internal path. @internal
Signals that a broker's transport cannot support brokered request-reply.
Adapts the real GCP Pub/Sub SDK module to the domain port.
Adapts the real Azure Service Bus SDK module to the domain port.
Derives the causal metadata a consumed envelope contributes to the event its handling publishes next — the whole of the chain-root rule, extracted so no handler copies it by hand.
Defines a versioned integration-event contract and validates it eagerly.
EventsMessagingBridge factory.
Lazily load the GCP Pub/Sub SDK.
Lazily load the Azure Service Bus SDK.
MessagingPlugin factory.
Produces a SubscriptionDefinition for an integration-event
contract — the declarative form, plugging straight into
MessagingPlugin({ subscriptions }), or spread by hand into an imperative
broker.subscribe after start().
Publishes one integration event: builds the envelope from the caller's
already-typed payload and hands it to broker.publish on the definition's
topic.
Custom (inject-any-broker) arm.
Options for the EventsMessagingBridge factory.
-
errorHandler: () => voiderror: unknown,eventType: string
Custom error handler for publish failures.
-
eventTypes: readonly string[]
The event types to forward to the messaging broker.
-
token: string
The capability token for the messaging broker to use.
-
topicMapping: (eventType: string) => string
Function to map event types to broker topics.
Message broker for cross-service integration events.
-
connect(): Promise<void>
Opens the broker connection.
-
disconnect(): Promise<void>
Closes the broker connection.
-
isHealthy(): Promise<boolean>
Reports whether the broker's backend is reachable right now, for the plugin's health indicator.
-
publish<T>(): Promise<void>topic: string,message: T
Publishes a message to a topic.
-
request<TReq, TRes>(): Promise<TRes>topic: string,message: TReq,options?: RequestOptions
Sends a request to a topic and awaits a single correlated reply, providing brokered request-reply (RPC) over the message broker.
-
respond<TReq, TRes>(): Promise<ISubscription>topic: string,handler: RequestHandler<TReq, TRes>,options?: SubscribeOptions
Registers a responder for a request topic. The handler's resolved value is sent back to the requesting caller, correlated to the originating request.
-
subscribe<T>(): Promise<ISubscription>topic: string,handler: MessageHandler<T>,options?: SubscribeOptions
Subscribes to a topic.
Public members used from NATS MsgHdrs.
-
get(key: string): string | undefined
Reads one header value.
-
keys(): Iterable<string>
Lists the header names.
-
set(): voidkey: string,value: string
Stores one header value.
Options for the in-memory broker — the adapter behind the memory arm of
MessagingPluginOptions, constructed by it and by applications
that build InMemoryBroker directly.
-
onDispatchError: () => void | Promise<void>error: unknown,metadata: MessageMetadata
Called once per REJECTED subscription handler, with the error and the message metadata of the failed dispatch.
publishresolves on dispatch hand-off — never on handler completion — so this reporter is the terminus of the broker's failure path: the in-memory broker has no ack model and no redelivery to fall back on (unlike RabbitMQ, where a rejection reaching the broker's failure path can nack and redeliver). Absent, the rejection is still observed and settled — never an unhandled rejection — then dropped. A reporter that itself throws or rejects is swallowed by the broker: it is the last-resort sink, so its own failure can neither rejectpublishnor abort the sibling fan-out nor surface as an unhandled rejection.MessagingPluginalways supplies one backed by the application's logger, so the absent case is reachable only by constructing the broker directly.
A named, versioned cross-service event contract.
-
parse: (value: unknown) => T
Narrows the delivered payload for the application handler. Runs on the consumer side only — never on publish.
-
topic: string
The transport topic the event is published to and consumed from.
-
type: string
The event's semantic name, carried in the envelope's
typefield. -
version: number
The contract version. A bump is a breaking payload change.
The wire shape of a published integration event.
-
aggregateId: string
ID of the aggregate the event concerns, when supplied.
-
aggregateVersion: number
Version of the aggregate the event concerns, when supplied.
-
causationId: string
ID of the event that directly caused this one, when propagated.
-
correlationId: string
ID of the chain root this event descends from, when propagated.
-
data: T
The event payload, as the producer published it.
-
id: string
Producer-assigned event identity (
runtime.uuid()). -
occurredAt: string
Publish time as an ISO-8601 string (
new Date(runtime.now()).toISOString()). -
type: string
The definition's semantic event name.
-
version: number
The definition's contract version.
Optional causal metadata for publishIntegrationEvent.
-
aggregateId: string
ID of the aggregate the event concerns.
-
aggregateVersion: number
Version of the aggregate the event concerns.
-
causationId: string
ID of the event that directly caused this one.
-
correlationId: string
ID of the causal chain root this event descends from.
Handle for an open Pub/Sub subscription.
-
close(): Promise<void>
Close the subscription.
Domain port for GCP Pub/Sub operations. The broker depends on this, not the SDK directly.
-
close(): Promise<void>
Close the client and all subscriptions.
-
createSubscription(): Promise<void>topic: string,subscription: string
Explicitly create a subscription (for RPC inbox).
-
deleteSubscription(subscription: string): Promise<void>
Delete a subscription (for RPC inbox teardown).
-
isHealthy(): Promise<boolean>
Reports whether the Pub/Sub backend is reachable (optional, M70c).
-
open(): Promise<IPubSubSubscription>topic: string,subscription: string,onMessage: (msg: { payload: string; ack: () => void; nack: () => void; attributes?: Readonly<Record<string, string>>; messageId?: string; timestamp?: Date; }) => void
Open a subscription on a topic. Creates the subscription when absent.
-
publish(): Promise<void>topic: string,bytes: Uint8Array,attributes?: Readonly<Record<string, string>>
Publish bytes to a topic.
Serializer contract for converting messages to/from string payloads.
-
deserialize<T = unknown>(payload: string): T
Deserializes a string payload to a value.
-
serialize<T>(value: T): string
Serializes a value to a string payload.
Structural type matching the real SDK's ProcessErrorArgs callback argument (npm:@azure/service-bus@^7).
-
entityPath: string
The entity path for the current receiver.
-
error: Error
The underlying error.
-
errorSource: "abandon"
| "complete"
| "processMessageCallback"
| "receive"
| "renewLock"The operation where the error originated.
-
fullyQualifiedNamespace: string
The fully qualified namespace for the Service Bus.
-
identifier: string
The identifier of the client that raised this event.
Structural receiver type carrying the real SDK settlement methods. Settlement belongs to the receiver — NOT the received message.
-
abandonMessage(): Promise<void>message: unknown,propertiesToModify?: Record<string, unknown>
- close(): Promise<void>
- completeMessage(message: unknown): Promise<void>
-
subscribe(): { close(): Promise<void>; }handlers: { processMessage: (message: unknown) => Promise<void>; processError: (args: IServiceBusProcessErrorArgs) => Promise<void>; },options?: IServiceBusSubscribeOptions
Structural receive-options matching the real SDK's SubscribeOptions (npm:@azure/service-bus@^7). The property is autoCompleteMessages, not autoComplete.
Handle for an open Service Bus subscription receiver.
-
close(): Promise<void>
Close the receiver.
Domain port for Azure Service Bus operations.
-
close(): Promise<void>
Close the client and all senders/receivers.
-
createSubscription(): Promise<void>topic: string,subscription: string
Create a subscription (for RPC inbox).
-
deleteSubscription(): Promise<void>topic: string,subscription: string
Delete a subscription (for RPC inbox teardown).
-
isHealthy(): Promise<boolean | undefined>
Reports whether the Service Bus namespace is reachable (optional, M70c).
-
open(): Promise<IServiceBusSubscription>topic: string,subscription: string,onMessage: (msg: { payload: string; ack: () => void; nack: () => void; applicationProperties?: Readonly<Record<string, string>>; messageId?: string; timestamp?: Date; }) => void | Promise<void>
Open a receiver on a topic subscription.
-
send(): Promise<void>topic: string,body: string,applicationProperties?: Readonly<Record<string, string>>
Send a body to a topic.
Kafka-specific options (internal use).
-
brokers: readonly string[]
Kafka bootstrap brokers.
-
client: IKafkaFactory
Injected Kafka factory.
-
clientId: string
Kafka client ID (default: 'messaging-client').
-
defaultQueue: string
Default consumer group name.
-
logger: { error: (msg: string) => void; }
Optional logger for error reporting.
-
replyTopic: string
Topic every request-reply response is published to and read back from.
Default (memory) arm. The discriminant is optional so that MessagingPlugin()
and MessagingPlugin({}) remain valid.
Transport metadata accompanying a delivered message.
-
headers: Readonly<Record<string, string>>
Transport headers read from the delivered message. First-party brokers populate this with
{}when their transport carried no headers. -
messageId: string
Broker-assigned message ID, when available.
-
timestamp: Date
Delivery timestamp, when available.
-
topic: string
The topic the message arrived on.
Shared options present on every MessagingPluginOptions arm.
-
behaviors: readonly (IIngressBehavior | RegistryFactory<IIngressBehavior>)[]
Ingress behaviours wrapped around every subscription handler — the messaging arm of the transport-neutral behaviour chain shared with the websocket, queue, and scheduler plugins (
IIngressBehaviorin@setu-ts/common). -
chainReadyTimeoutMs: number
Bounds a dispatch held on the behaviour-chain gate, which exists only when a
RegistryFactorybehaviour is declared. A held dispatch that waits longer than this rejects withChainGateTimeoutError, whose message names the likely cause (a plugin publishing during its ownregister()); the gate itself is left in place, so later dispatches refuse the same way rather than delivering through a partial chain. -
name: string
Instance name for multi-instance support.
-
serializer: ISerializer
Serializer for message payloads.
-
subscriptions: readonly SubscriptionEntry[]
Subscriptions registered declaratively, as an alternative to calling
broker.subscribe(topic, handler, options)imperatively afterstart(). Each entry — instance orRegistryFactory— produces onesubscribe()call, so a subscription can be declared where the plugin is composed instead of after the application has started. -
tracing: boolean
Whether to create producer and consumer spans when telemetry is available.
NATS arm.
- broker: "nats"
- client: INatsConnection
- defaultQueue: string
-
headersFactory: () => INatsHeaders
Factory building the NATS
MsgHdrsused to carry transport headers. - streamName: string
-
streamSubjects: readonly string[]
Subjects the broker may create streamName with when the stream is absent on the server.
- url: string
NATS-specific options (internal use).
-
client: INatsConnection
Injected NATS connection.
-
defaultQueue: string
Default consumer group name.
-
headersFactory: () => INatsHeaders
Factory for NATS headers when an application injects the connection.
-
logger: { error: (msg: string) => void; }
Optional logger for error reporting.
-
streamName: string
JetStream stream name (default: 'MESSAGING').
-
streamSubjects: readonly string[]
Subjects the broker may create the stream with when it is absent (X28-2). No default: with the stream absent and this unset,
connect()throwsJetStreamStreamErrornaming both remedies. SeeNatsMessagingOptions.streamSubjectsfor the full behavior. -
url: string
NATS connection URL(s).
Options for GCP Pub/Sub broker.
-
client: IPubSubTransport
Injected transport (bypasses lazy SDK load).
-
credentials: unknown
Service-account credentials (object or key path). SDK ADC is used when omitted.
-
defaultQueue: string
Default consumer-group subscription name.
-
logger: { error: (msg: string) => void; }
Optional logger.
-
projectId: string
GCP project ID. Required unless client is injected.
-
replyTopic: string
Shared reply topic for request-reply (must pre-exist).
Declares the constructors used from the real GCP Pub/Sub SDK so the adapter can build a domain port. This is NOT an SDK-shaped structural facade — it names only what the adapter actually uses.
RabbitMQ-specific options (internal use).
-
client: IAmqpConnection
Injected AMQP connection.
-
defaultQueue: string
Default consumer group/queue name.
-
exchangeName: string
Exchange name (default: 'messaging').
-
logger: { error: (msg: string) => void; }
Optional logger for error reporting.
-
url: string
RabbitMQ connection URL.
Redis-specific options (internal use).
-
blockSizeMs: number
Block timeout in milliseconds.
-
client: IRedisStreamsClient
Injected Redis client.
-
defaultQueue: string
Default consumer group name.
-
logger: { error: (msg: string) => void; }
Optional logger for error reporting.
-
pollIntervalMs: number
Poll interval in milliseconds.
-
url: string
Redis connection URL.
Options accepted by IMessageBroker.request.
-
timeoutMs: number
Reply wait budget in milliseconds. When no correlated reply arrives within this window,
requestrejects. Defaults to5000when omitted.
Options for Azure Service Bus broker.
-
adminConnectionString: string
Connection string for the administration client (reply-subscription creation). Defaults to connectionString.
-
client: IServiceBusTransport
Injected transport (bypasses lazy SDK load).
-
connectionString: string
Connection string for the Service Bus namespace. Required unless client is injected.
-
defaultQueue: string
Default subscription name.
-
logger: { error: (msg: string) => void; }
Optional logger.
-
replyTopic: string
Shared reply topic for request-reply (must pre-exist).
-
retryOptions: ServiceBusRetryOptions
SDK retry budget for the data client (M90b / X28-6). Forwarded to
ServiceBusClientonly — the administration client is never given it.
Azure Service Bus SDK retry budget for the data client (M90b / X28-6).
-
maxRetries: number
Maximum number of retry attempts before an operation fails. The SDK default is
3;0disables retries entirely. -
maxRetryDelayInMs: number
Ceiling the exponential backoff grows to, in milliseconds. The SDK default is
90000. -
mode: "fixed" | "exponential"
Backoff curve. Translated to the SDK's numeric
RetryModebeforeServiceBusClientis constructed (the SDK compares the value with===against its enum). The SDK default when omitted is'fixed'. -
retryDelayInMs: number
Delay before the first retry, in milliseconds. The SDK default is
30000. -
timeoutInMs: number
Whole-operation timeout, in milliseconds. The SDK default is
60000.
Declares the constructors used from the real Azure Service Bus SDK.
-
RetryMode: { readonly Exponential: number; readonly Fixed: number; }
The SDK's numeric
RetryModeenum (re-exported by@azure/service-bus). The publicServiceBusRetryOptions.modestring is translated through this before reaching the SDK —@azure/core-amqpcompares the value with===against its enum, so an untranslated string silently behaves as the SDK default (Fixed). -
ServiceBusAdministrationClient: new (connectionString: string) => { createSubscription(): Promise<unknown>; deleteSubscription(topicName: string,subscriptionName: string): Promise<unknown>; getNamespaceProperties?(): Promise<unknown>; }topicName: string,subscriptionName: string
-
ServiceBusClient: new () => { createSender(queueOrTopicName: string): { sendMessages(messages: { body: unknown; }): Promise<void>; close(): Promise<void>; }; createReceiver(connectionString: string,options?: { retryOptions?: Omit<ServiceBusRetryOptions, "mode"> & { mode?: number; }; }): IServiceBusReceiver; createReceiver(queueName: string,options?: unknown): IServiceBusReceiver; close(): Promise<void>; }topicName: string,subscriptionName: string,options?: unknown
Options accepted when subscribing to a topic.
-
queue: string
Consumer group / queue name for load-balanced delivery.
The declarative form of one IMessageBroker.subscribe() call — the entry
an application writes instead of calling subscribe() imperatively after
start().
-
handler: MessageHandler
Invoked per delivered message, exactly as the imperative
subscribe()accepts. -
options: SubscribeOptions
Consumer-group configuration, exactly as the imperative
subscribe()accepts. -
topic: string
The topic to subscribe to (the
subscribe()topic argument).
Handles one delivered integration event.
Why an integration-event delivery was refused before the application handler ran. The four values are the four distinct producer-side faults an operator triaging a dead-letter needs to tell apart.
Handles messages delivered on a subscription.
| PubSubMessagingOptionsProduction
GCP Pub/Sub options — exclusive union of injected and production arms.
Responder for a request topic. Its resolved value is sent back to the caller as the reply, correlated to the originating request.
| ServiceBusMessagingOptionsProduction
Azure Service Bus options — exclusive union of injected and production arms.
| RegistryFactory<SubscriptionDefinition>
One entry of MessagingCommonOptions.subscriptions: a
subscription definition, or a RegistryFactory producing one
when the handler needs a resolved capability.
Usage
import * as Message_broker_plugin_for_cross_service_integration_events___Provides_an__IMessageBroker__implementation_with_support_for_in_memory__Redis_Streams__RabbitMQ__NATS__JetStream___Kafka__GCP_Pub_Sub__Azure_Service_Bus__and_custom_injected_backends__plus_an_optional_bridge_from_the_in_process_event_bus_to_external_messaging__ from "messaging-plugin/src/index.ts";