Docs
Search…
⌃K

NATS

Plumber supports reading/writing/relay NATS, NATS Streaming, and NATS JetStream

NATS

Reading

plumber read nats --dsn "nats://localhost:4222" --subject new_customers

Writing

plumber write nats \
--dsn "nats://user:[email protected]:4222" \
--subject new_customers \
--input '{"id": "1224", "name": "John Q Customer"}'

Relaying

docker run --name plumber-nats -p 8080:8080 \
-e PLUMBER_RELAY_TOKEN=$YOUR-BATCHSH-TOKEN-HERE \
-e PLUMBER_RELAY_NATS_DSN="nats://user:[email protected]:4222" \
-e PLUMBER_RELAY_NATS_SUBJECT="new_customers" \
batchcorp/plumber relay nats

NATS Streaming

NATS Streaming ("stan") is deprecated in favor of JetStream. plumber will continue to support NATS Streaming.

Reading

plumber read nats-streaming \
--channel "new_customers" \
--cluster-id "[FROM YOUR SERVER CONFIG]" \
--client-id "plumber"

Writing

plumber write nats-streaming \
--channel "new_customers" \
--cluster-id "[FROM YOUR SERVER CONFIG]" \
--client-id "plumber-producer" \
--input '{"id": "1224", "name": "John Q Customer"}'

Relaying

docker run -bash-name plumber-nats -p 8080:8080 \
-e PLUMBER_RELAY_TOKEN=$YOUR-BATCHSH-TOKEN-HERE \
-e PLUMBER_RELAY_NATS_STREAMING_DSN="nats://user:[email protected]:4222" \
-e PLUMBER_RELAY_NATS_CHANNEL="new_customers" \
-e PLUMBER_RELAY_NATS_STREAMING_CLUSTER_ID="[FROM YOUR SERVER CONFIG]" \
-e PLUMBER_RELAY_NATS_STREAMING_CLIENT_ID="plumber-relayer" \
-e PLUMBER_RELAY_NATS_STREAMING_READ_LAST=true \
batchcorp/plumber relay nats-streaming

NATS JetStream

Reading

plumber read nats-jetstream \
--dsn "nats://localhost:4222" \
--stream new_customer_streams

Writing

plumber write nats \
--dsn "nats://user:[email protected]:4222" \
--stream new_customers \
--input '{"id": "1224", "name": "John Q Customer"}'

Relaying

docker run --name plumber-nats -p 8080:8080 \
-e PLUMBER_RELAY_TOKEN=$YOUR-BATCHSH-TOKEN-HERE \
-e PLUMBER_RELAY_NATS_DSN="nats://user:[email protected]:4222" \
-e PLUMBER_RELAY_NATS_SUBJECT="new_customers" \
-e PLUMBER_RELAY_NATS_JETSTREAM_STREAM="new_orders" \
batchcorp/plumber relay nats-jetstream