Docs
Search…
NATS
Plumber supports reading/writing/relay NATS, NATS Streaming, and NATS JetStream

NATS

Reading

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

Writing

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

Relaying

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

NATS Streaming

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

Reading

1
plumber read nats-streaming \
2
--channel "new_customers" \
3
--cluster-id "[FROM YOUR SERVER CONFIG]" \
4
--client-id "plumber"
Copied!

Writing

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

Relaying

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

NATS JetStream

Reading

1
plumber read nats-jetstream \
2
--dsn "nats://localhost:4222" \
3
--stream new_customer_streams
Copied!

Writing

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

Relaying

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