Skip to main content

Interface: ConnectNatsOptions

Defined in: packages/messaging/src/nats.ts:47

Options for connectNats.

Properties​

logger?​

readonly optional logger?: MessagingLogger

Defined in: packages/messaging/src/nats.ts:70

Where permission violations on the connection are logged. Defaults to discarding.


maxReconnectAttempts?​

readonly optional maxReconnectAttempts?: number

Defined in: packages/messaging/src/nats.ts:78

Reconnect attempts after the connection is lost, 2 seconds apart. Default -1: never give up. The client's own default is 10, which ends the connection for good after about 20 seconds of outage; a closed connection does not come back, so every service on it (the audit relay's publishes, the consumer, the gateway's dispatch) would stay broken until restarted, long after the broker returned.


name​

readonly name: string

Defined in: packages/messaging/src/nats.ts:54

The connection name, shown in the broker's monitoring. Usually the principal's name; a test or a smoke script may add a suffix to tell its connections apart.


nkey​

readonly nkey: object

Defined in: packages/messaging/src/nats.ts:63

Where the principal's nkey seed lives. The seed is revealed once, here.

reference​

readonly reference: string

A secret:// reference to the user nkey seed.

store​

readonly store: SecretStore

The store the seed is read from.


principal​

readonly principal: "gateway" | "gateway-admin" | "audit" | "provisioning" | "bootstrap" | "credential" | "agent-shared"

Defined in: packages/messaging/src/nats.ts:61

The broker principal the nkey belongs to. It sets the connection's inbox prefix, _INBOX.<principal>, which is the only reply space the broker lets this principal subscribe to. A principal that does not match the seed connects, and then every request and JetStream publish it makes is refused for want of a reply subject.


servers​

readonly servers: string | readonly string[]

Defined in: packages/messaging/src/nats.ts:49

Broker URLs.