Expand description
Shared NATS server-list and JetStream context helpers.
The streamer, archiver, exporter and subscriber all connect to a NATS server (by default the local one), and the streamer and archiver open JetStream contexts, including ones on a central server for configuration mirroring. These helpers read the server list and the optional JetStream domain from the environment in one consistent way.
§Configuration
NATS_SERVERS- Comma-separated NATS server URLs, read byservers_from_env. Default:nats://127.0.0.1:4222.JS_DOMAIN- JetStream domain, read byjetstream_context. Unset or blank means no domain.
Constants§
- DEFAULT_
NATS_ 🔒SERVERS - Default NATS server URL used when
NATS_SERVERSis unset: the local server on the standard NATS port.
Functions§
- jetstream_
context - Creates the default JetStream context, using
JS_DOMAINas the domain if set. - jetstream_
context_ for_ domain - Creates a JetStream context for an explicit optional domain.
- jetstream_
context_ from_ env - Creates a JetStream context using a domain name read from an environment variable.
- servers_
from_ env - Parses
NATS_SERVERS, defaulting toDEFAULT_NATS_SERVERS. - servers_
from_ env_ var - Parses a comma-separated NATS server list from an environment variable.