Connectors / Streaming & queues

NATS

sink

NATS sink; publish records to a subject, flush per batch

Install

cargo install faucet-cli --features sink-nats
faucet init --sink nats
# Cargo.toml — use it as a library
cargo add faucet-sink-nats

Starter config

sink:
  type: nats
  config:
    # servers: ["nats://127.0.0.1:4222"]    # One or more NATS server URLs, e.g.
    # auth: { type: none }    # one of: none, token, user_password, n_key, creds_file
      # --- Alternative variants — replace the block above with one of these ---
      # type: token
      # config:
        # token: ""    # REQUIRED
      #
      # type: user_password
      # config:
        # username: ""    # REQUIRED
        # password: ""    # REQUIRED
      #
      # type: n_key
      # config:
        # nkey: ""    # REQUIRED
      #
      # type: creds_file
      # config:
        # path: ""    # REQUIRED
    # tls: null    # `tls:` on the wire: a flag or a settings block.
    # name: ""    # Optional client connection name (surfaced in NATS server monitoring).
    # ignore_discovered_servers: false    # Connect only to `servers`, ignoring the cluster members a server advertises.
    subject: ""    # REQUIRED — Default subject every record is published to.
    # subject_field: ""    # Optional top-level record field whose (string) value overrides `subject` on a per-record basis — the subject-per-record pattern.
    # batch_size: 1000    # Records per publish batch: the client is flushed (core NATS) or the acks awaited (JetStream) after every `batch_size` records.
    # jetstream: false    # Publish through JetStream and await each message's acknowledgement, so a publish no stream stores (no stream bound to the subject, a stream limit, a rejected message) fails its row instead of vanishing.
    # publish_timeout_secs: 30    # Seconds a publish batch (publishes plus the flush, or the JetStream acks) may take, so a server outage cannot wedge the run.

Capabilities

Delivery At-least-once
Write modes append
Exactly-once writes No
Schema evolution No
Scoped cleanup No
Staged bulk load No
Run rollback No
Compression No

Config fields

FieldTypeDefaultDescription
subject
required
string — Default subject every record is published to.
servers array ["nats://127.0.0.1:4222"] One or more NATS server URLs, e.g. ["nats://127.0.0.1:4222"]. The client connects to the first reachable server and uses the rest for failover.
auth object type: none Authentication mode. Defaults to none (anonymous).
tls boolean | object false TLS: true to require it with the platform roots, or a block with ca_cert_path / ca_cert_pem, client_cert_path + client_key_path and insecure_skip_verify (which also requires TLS). Defaults to false.
name string — Optional client connection name (surfaced in NATS server monitoring).
ignore_discovered_servers boolean — Connect only to servers, ignoring the cluster members a server advertises. Defaults to false.
subject_field string — Optional top-level record field whose (string) value overrides subject on a per-record basis — the subject-per-record pattern. When the field is missing or is not a string the sink errors.
batch_size integer 1000 Records per publish batch: the client is flushed (core NATS) or the acks awaited (JetStream) after every batch_size records. Defaults to DEFAULT_BATCH_SIZE. 0 publishes the whole page handed by the pipeline before flushing / awaiting once.
jetstream boolean false Publish through JetStream and await each message's acknowledgement, so a publish no stream stores (no stream bound to the subject, a stream limit, a rejected message) fails its row instead of vanishing. Each row gets its own outcome, so failed rows can go to a DLQ. Default false: core NATS publish, which only confirms the server received the bytes.
publish_timeout_secs integer 30 Seconds a publish batch (publishes plus the flush, or the JetStream acks) may take, so a server outage cannot wedge the run. On a timeout the rows not yet confirmed fail with a timeout-class row error: a resilience.poison policy resubmits them, otherwise they go to the DLQ; earlier batches keep their outcomes. A timed-out flush is retried by resilience.retry. Default 30.
Get started

Your first pipeline runs in five minutes.

Install the CLI, scaffold a config, and move real data — nothing external to stand up.

curl -LsSf https://github.com/faucet-hq/faucet-stream/releases/latest/download/faucet-cli-installer.sh | sh
brew install faucet-hq/faucet-stream/faucet-cli