JetStream
This mini-tutorial shows how to run a NATS server with JetStream enabled in a local Docker container. This enables quick and consequence-free experimentation with the many features of JetStream.
Using the official nats
image, start a server. The -js
option is passed to the server to enable JetStream. The -p
option forwards your local 4222 port to the server inside the container, 4222 is the default client connection port.
With the server running, use nats bench
to create a stream and publish some messages to it.
JetStream persists the messages (on disk by default). Now consume them with:
You can use nats
to inspect various aspects of the stream, for example:
Related and useful:
Official Docker image for the NATS server on GitHub and issues
Last updated