Skip to content

The Neighbours

Outcome: you can place NATS among the messaging tools it is confused with, and say for each what it does that NATS does not — and the reverse — without reaching for a benchmark.

These characterisations are from each project's documentation and this guide's sibling volumes; the neighbours were not re-run for this chapter.

RabbitMQ — the post office

RabbitMQ (the subject of its own guide in this series) is a full broker in the postal sense: exchanges route messages to queues by rules, queues hold them until a consumer confirms receipt, and delivery guarantees are the centre of the design. If your mental model is mail that must arrive, RabbitMQ speaks it natively. NATS's core is the opposite centre — announcements that may be missed — and JetStream narrows the gap from the NATS side with stored streams and acknowledgements. Choose RabbitMQ when routing rules and per-queue semantics are the problem; choose NATS when the problem is many programs needing a light, shared nervous system, and a single small binary is worth more than a routing language.

MQTT — the protocol of small devices

MQTT (likewise, its own guide) is a publish/subscribe protocol designed for sensors and embedded things: brokers like Mosquitto, topics with wildcards, quality- of-service levels, retained messages, and a last will. The family resemblance to NATS is real — subjects and topics are cousins — and the difference is the audience: MQTT's clients live in thermostats and microcontrollers and speak a protocol made for feeble networks, while NATS's live in services and speak a protocol made for speed. They meet often: gateways bridge MQTT devices into NATS systems, and NATS's own leaf nodes borrow the edge idea. If the publisher has a battery, think MQTT first; if it has a build pipeline, think NATS.

Redis — the database that also talks

Redis (its own guide too) is a data store first: keys, hashes, lists, sorted sets. It also does publish/ subscribe, and its Streams type keeps an acknowledged, replayable log somewhat like JetStream's. If your system already runs Redis for its data, its messaging may be enough, and one less server is a real virtue. NATS inverts the emphasis — messaging first, with the key-value and object stores as conveniences rather than a general database — and core NATS is dramatically lighter than any store-backed channel. Choose by asking which half you would keep if you could only keep one.

Kafka — the archivist

Apache Kafka keeps everything: a distributed, replayable log measured in days and terabytes, consumed by offset, built for event streaming at organisational scale — and operated as a cluster of brokers with the ceremony that implies. JetStream borrows the log idea at room scale: one server, honest limits, an afternoon to learn. If your problem is "every event, forever, for the whole company", that is Kafka's home ground and NATS does not pretend otherwise. If it is "these six programs on these two machines must not lose an order", Kafka is a sledgehammer hung on a picture hook.

The smaller print

  • ZeroMQ is a library, not a server: sockets with patterns, no broker at all. Wonderful inside one system; it leaves discovery, persistence and security entirely to you.
  • A shared database, polled, and cron jobs dropping files remain what they were in chapter 1: workable right up to the moment a second listener, a timing requirement, or a failure lands — the moment this guide exists for.
  • Webhooks and direct HTTP calls couple caller and callee in time and address; they are request/reply with neither the no-responders kindness nor the queue group's load sharing. Sometimes that is exactly enough. Know that it is a choice.

Check: for each neighbour, one sentence — what it does that NATS doesn't. If you can produce all four, chapter 13's limits will read as design rather than as apology.