Create NATS JetStream streams and push/pull consumers

domain: docs.nats.io · 5 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Enable JetStream on the NATS server by adding jetstream: {} to the server config and restarting, or use a JetStream-enabled NATS server
  2. Create a stream with nats stream add, specifying subjects to capture, retention policy (limits, interest, or workqueue), and storage type (file or memory)
  3. Create a pull consumer with nats consumer add --pull, setting deliver policy (all, new, by-start-sequence, or by-start-time) and ack policy
  4. In your client, fetch messages with js.fetch(consumer, batchSize) and acknowledge each with msg.ack() or nak for retry
  5. Create a push consumer for lower-latency delivery by specifying a deliver subject; messages are pushed to subscribers on that subject

Known gotchas

Related routes

Configure a NATS JetStream stream with WorkQueue retention for single-consumption FIFO job distribution
docs.nats.io · 6 steps · unrated
Use NATS JetStream stream mirroring and sourcing for cross-account replication
nats · 6 steps · unrated
tune nats jetstream consumer flow control with ackwait, maxackpending, and maxdeliver to prevent redelivery storms
docs.nats.io · 5 steps · unrated

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans