Configure a NATS JetStream stream with WorkQueue retention for single-consumption FIFO job distribution

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

Steps

  1. Create a stream and set its retention policy to WorkQueuePolicy (as opposed to the default LimitsPolicy or InterestPolicy)
  2. Understand that WorkQueuePolicy enforces FIFO-style, consume-once semantics: each message is automatically deleted from the stream as soon as it is acknowledged by a consumer
  3. Create only consumers whose subject filters do not overlap on a WorkQueue stream — the server enforces at most one consumer per subject on this stream type, since overlapping consumers could both claim the same message
  4. Bind one or more worker processes to the same non-overlapping consumer (using a pull consumer with multiple pullers, for example) to distribute the FIFO workload among them while each message is still processed exactly once
  5. Set upper-bound limits (MaxMsgs, MaxBytes, MaxAge) alongside WorkQueuePolicy if desired; these limits are additive/enforced on top of the work-queue consumption behavior, not a replacement for it
  6. Ack each message promptly after processing so the stream storage doesn't grow unbounded waiting on unacknowledged messages

Known gotchas

Related routes

tune nats jetstream consumer flow control with ackwait, maxackpending, and maxdeliver to prevent redelivery storms
docs.nats.io · 5 steps · unrated
Create NATS JetStream streams and push/pull consumers
docs.nats.io · 5 steps · unrated
Use NATS JetStream KV store watchers with UpdatesOnly and TTL-based purge for live distributed configuration
docs.nats.io · 6 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