Load-balance responders across processes using Core NATS queue groups for request-reply

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. Have each responder process create a subscription on the same subject and the same queue group name (e.g. all instances subscribe to 'orders.process' with queue name 'order-workers')
  2. NATS automatically load-balances: for each published message, the server delivers to exactly one randomly chosen member of the queue group, not to all of them
  3. For request-reply, have the requester use the standard request API on the subject; only one queue-group member replies, since only one receives the request
  4. Scale out by simply starting more responder processes subscribed to the same subject/queue name — no server-side configuration is required, queue groups are purely client-driven
  5. Scale down gracefully by having a responder drain (unsubscribe cleanly) before shutting down so in-flight requests complete rather than being dropped mid-processing
  6. Combine multiple queue groups on the same subject if you need both a load-balanced worker pool and a separate set of subscribers each seeing every message (queue subscribers vs. plain subscribers coexist on the same subject)

Known gotchas

Related routes

Load-balance SIP requests across a gateway pool using the Kamailio dispatcher module.
kamailio.org · 5 steps · unrated
Use MQTT 5 shared subscriptions to load-balance messages across a consumer group of subscribers
docs.hivemq.com · 6 steps · unrated
Tune Flink job operator chaining and slot sharing groups to control physical task layout and resource isolation on a cluster
flink.apache.org · 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