Setu-TS
    Preparing search index...

    NATS JetStream message broker implementation.

    0.1.0

    Implements

    • MessageBrokerAdapter
    Index
    • Connects to NATS and ensures the JetStream stream exists.

      Returns Promise<void>

      Resolves when connected

      When the server has no JetStream enabled (start it with the -js flag)

      When the stream is absent and NatsOptions.streamSubjects was not supplied, or when the platform refuses the stream read/create

      0.1.0

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

      Returns Promise<boolean>

      true when reachable or unprobeable, false when the fault window is active or the connection is closed

      0.1.0

    • Publishes a message to a subject (topic).

      Type Parameters

      • T

        The message payload type

      Parameters

      • topic: string

        The subject to publish to

      • message: T

        The message payload

      • Optionaloptions: PublishOptions

        Optional publish headers, ordering key and de-duplication id

      Returns Promise<void>

      Resolves when published

      When the acknowledgement exceeds publishTimeoutMs; the message may still be delivered

      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

    • Tri-state backend reachability (M70c).

      nats reconnects itself, so the broker runs the supervisor in observe mode: Disconnect/Reconnect events mark the fault window, and the probe is isClosed() === false and rtt() resolving. true when both hold, false when the window is active or the connection reports closed, undefined when the injected client exposes neither member (a minimal fake) — the indicator then reports reachable: 'unknown'.

      Returns Promise<boolean | undefined>

      true/false/undefined as described

      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

    • Subscribes through a durable JetStream group. Without an explicit queue, replicas share <defaultQueue>.<topic>, starting at new messages when the group is first created. Explicit queues retain the server's delivery policy. Internal reply inboxes use ephemeral consumers and recover deleted handles.

      Type Parameters

      • T

        The message payload type

      Parameters

      • topic: string

        The subject to subscribe to

      • handler: MessageHandler<T>

        The handler to invoke for each message

      • Optionaloptions: SubscribeOptions

        Optional subscription options (queue for durable consumer name, encoded through toJetStreamConsumerName)

      Returns Promise<ISubscription>

      The subscription handle

      When the queue's consumer name already belongs to a different queue or topic

      0.1.0