Skip to content

NatsActorSettings

Defined in: src/io/broker/NatsActor.ts:24

Common settings every broker actor accepts on top of its protocol- specific options. Subclasses extend this interface with their own required fields (e.g. brokerUrl, topics).

readonly optional circuitBreaker?: object

Defined in: src/io/broker/BrokerSettings.ts:28

Optional circuit-breaker around connectImpl. After failureThreshold consecutive failed connect attempts the breaker opens for resetMs and rejects new attempts immediately.

readonly failureThreshold: number

readonly resetMs: number

BrokerCommonSettings.circuitBreaker


readonly optional name?: string

Defined in: src/io/broker/NatsActor.ts:34

Optional client name reported to the server.


readonly optional outboundBuffer?: number

Defined in: src/io/broker/BrokerSettings.ts:41

Maximum number of outbound messages buffered while the connection is connecting or disconnected. When the buffer is full the oldest message is dropped (FIFO eviction) and a BrokerBufferOverflow event is published. Default: 1000. Set to 0 to fail-fast (publish a BrokerNotConnected event and drop the message).

BrokerCommonSettings.outboundBuffer


readonly optional password?: string

Defined in: src/io/broker/NatsActor.ts:30


readonly optional reconnect?: false | { factor?: number; initialDelayMs?: number; maxAttempts?: number; maxDelayMs?: number; }

Defined in: src/io/broker/BrokerSettings.ts:15

Reconnect strategy applied when the underlying connection drops or connectImpl throws. Default: exponential backoff starting at 200ms, doubling, capped at 30s, infinite attempts. Set to false to disable auto-reconnect (one-shot connections).

false


{ factor?: number; initialDelayMs?: number; maxAttempts?: number; maxDelayMs?: number; }

readonly optional factor?: number

readonly optional initialDelayMs?: number

readonly optional maxAttempts?: number

Cap on retry attempts. Default: Infinity (retry forever).

readonly optional maxDelayMs?: number

BrokerCommonSettings.reconnect


readonly optional servers?: string | readonly string[]

Defined in: src/io/broker/NatsActor.ts:26

NATS server URLs ('nats://localhost:4222').


readonly optional subscriptions?: readonly object[]

Defined in: src/io/broker/NatsActor.ts:32

Subscriptions wired up at connect time. Subjects support * and > wildcards (NATS-side).


readonly optional token?: string

Defined in: src/io/broker/NatsActor.ts:28

Optional credentials (token / user-password).


readonly optional user?: string

Defined in: src/io/broker/NatsActor.ts:29