method NatsBroker.prototype.connect
Since 0.1.0
NatsBroker.prototype.connect(): Promise<void>

Connects to NATS and ensures the JetStream stream exists.

Return Type

Promise<void>

Resolves when connected

Throws

JetStreamUnavailableError

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

JetStreamStreamError

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

Usage

import { NatsBroker } from "messaging-plugin/src/index.ts";