NATS
Configuration reference for the NATS+JetStream stream source: authentication modes, ephemeral vs. durable consumers, source/sink options, and troubleshooting.
NATS is a lightweight, high-performance open-source messaging system. Its persistence layer, JetStream, adds durable streams, message replay, and work queues. Nilus consumes NATS+JetStream as a stream source (spec.type: stream): an ephemeral JetStream consumer pulls records in configurable batches and writes them to the configured sink.
Nilus connects to a JetStream cluster directly through the nats+jetstream:// URI scheme, there is no DataOS depot variant for NATS today.
Requirements
Connectivity and credentials must both be in place before the pipeline can run.
Connectivity
The Nilus runtime must reach the NATS server on the configured TCP port (default
4222).JetStream must be turned on for the server, and the chosen subject must be backed by a durable stream the consumer can read.
The credentials in the URI must grant: connect, subscribe to the chosen subject, and read access on the JetStream stream.
Authentication
NATS supports several authentication modes; pick whichever the server is set up for.
Username & password
nats+jetstream://{NATS_USERNAME}:{NATS_PASSWORD}@<host>:<port>?...
Static token
nats+jetstream://<host>:<port>?token={NATS_TOKEN}&... (or nats+jetstream://{NATS_TOKEN}@<host>:<port>?...)
NKeys seed
nats+jetstream://<host>:<port>?nkeys_seed={NATS_NKEYS_SEED}&...
Required parameters
subject
Yes
-
NATS subject the JetStream consumer filters on. Supplied in the URI query string.
source_table
Yes
-
Used as the JetStream stream name the consumer attaches to. Passed under source.options.
Optional parameters
host
localhost
NATS server hostname. Provided in the URI authority.
port
4222
NATS server port. Provided in the URI authority.
durable
-
Name to use for a durable JetStream consumer. Set this when you want the consumer (and offsets) to persist across pipeline restarts.
batch_size
100
Maximum number of messages pulled per micro-batch.
timeout
10
Maximum seconds Nilus waits to fill a batch before flushing.
run_in_loop
false
When true, the stream service stays running and continues pulling new batches indefinitely.
URI format
Core concepts
Sequence-based consumption. Nilus tracks JetStream sequence numbers, analogous to Kafka offsets, so a restart resumes from the last processed record.
Ephemeral vs. durable consumers. By default, Nilus creates an ephemeral JetStream consumer per pipeline. Set
durable=<name>to attach to (or create) a durable consumer so offsets survive pipeline restarts.Filter subject. The JetStream consumer is filtered by the
subjectparameter, so a single stream can feed multiple Nilus pipelines on different subjects.Acknowledgment policy. Nilus uses
AckNone(auto-commit) and an instant replay policy. This is intentional for high-throughput pipelines; if you need exactly-once semantics, model deduplication on the sink side usingincremental_strategy: merge.
Source options
subject
Yes
NATS subject to subscribe to.
source.address query string
source_table
Yes
JetStream stream name.
source.options
durable
No
Durable consumer name.
source.address query string
batch_size
No
Messages per micro-batch.
source.address query string
timeout
No
Seconds to wait for a batch.
source.address query string
Auth params
No
token, nkeys_seed, or basic-auth credentials.
source.address
run_in_loop
No
Keep the consumer running after the first batch.
source.options
Examples
Local development cluster, no auth
Username and password, durable consumer
Token authentication
NATS NKeys seed
Sink options
dest_table
Yes
Destination object (schema.table for warehouses, fully-qualified path for object stores).
incremental_strategy
Yes
Write strategy: append, replace, or merge. Streaming pipelines normally use append.
primary_key
When incremental_strategy: merge
Column(s) used to deduplicate.
create_table
No
Auto-create the destination if missing. Default: true.
Example sink
Sample Nilus config
Best practices
Use dedicated subjects for ingestion so the JetStream consumer is not woken by unrelated traffic.
Set
durable=<name>on production pipelines so offsets survive pipeline restarts.Tune
batch_sizeandtimeouttogether: larger batches improve sink throughput, larger timeouts reduce empty pulls on quiet subjects.Always set
run_in_loop: truefor long-running stream services. Without it, Nilus exits after the first pull.Monitor JetStream consumer pending messages and sequence lag from the NATS server side; sustained lag is the leading indicator of an under-sized pipeline.
Troubleshooting
no responders available for stream
The JetStream stream named in source_table does not exist.
Create the stream on the NATS server (or correct the name) before starting the pipeline.
permissions violation
The authenticated user is missing subscribe or JetStream read permissions.
Update the NATS authorization to allow subscribe on the subject and read on the stream.
Pipeline exits after the first batch
run_in_loop not set.
Set run_in_loop: true under source.options.
Old data is replayed on restart
Ephemeral consumer was recreated and replay starts from the beginning.
Set a stable durable=<name> so the consumer (and its offsets) persist.
Token / nkeys auth fails
Secret not projected into the URI.
Project the credential through spec.use.projection and reference it as a {PLACEHOLDER} in the URI.
Related docs
Last updated
Was this helpful?