CMD Guide
HomeSystem DesignKafka

Popular Messaging Queue Systems

Every asynchronous system eventually reaches for a message broker, but "RabbitMQ vs Kafka vs SQS vs ActiveMQ" is the wrong first question. The right first question is about mechanism: does your workload want a queue or a log? Almost every difference in throughput, ordering, replay, and operational cost falls out of that one choice. Learn the mechanism, and picking a product becomes a lookup instead of a guess.

The one distinction that explains everything: queue vs log

A queue (RabbitMQ, Amazon SQS, classic ActiveMQ) is a consume-and-destroy structure. The broker hands each message to one worker, waits for an acknowledgement, then deletes it. The broker owns delivery state; it actively pushes work and tracks who has what. Add more workers and they compete for messages off the same queue, which is exactly how you parallelise a task backlog. The message is gone once it is done — there is nothing to re-read.

A log (Apache Kafka) is an append-only, retained structure. Producers append records to the end of a partition; the broker keeps every record for a retention window (say 7 days) whether or not anyone has read it. Consumers are not handed messages — they pull and remember their own position with an offset, a bookmark into the log. Two independent consumer groups can read the same partition at different offsets without interfering, and either can rewind to re-process history. The broker is a dumb, fast file; the smarts live in the consumer.

That single mechanical difference — who owns the read position, and does the message survive being read — is the root cause of nearly every downstream trade-off:

diagram
diagram

A workload-signal rubric: read your requirements, not the marketing

Skip feature checklists. Instead, match the signal in your workload to the mechanism, then to a product:

Signal in your workloadWhat it points toDefault pick
"Run this job once, then it's done" (emails, thumbnails, payments)Queue — competing consumers, ack-and-deleteRabbitMQ / SQS
"Many independent teams need the same events" (analytics + search + audit off one stream)Log — cheap fan-out, per-group offsetsKafka
"I must be able to reprocess history" (rebuild a read model, fix a bad consumer)Log — retention + offset resetKafka
"Complex routing: topic/header/pattern-based delivery"Queue with a rich broker (exchanges, selectors)RabbitMQ / ActiveMQ
"I don't want to run infrastructure"Managed queueSQS
"Millions of msg/s, ordered per key, durable"Log — partitioned, sequential I/OKafka
"Strict per-entity ordering" (not "exactly-once processing")Key by entity on a log partition, or FIFO message groupKafka (keyed) / SQS FIFO — still at-least-once; add consumer idempotency for effectively-once

Two signals dominate in practice: "is the message a task or an event?" (task → queue; event others may also care about → log) and "do I ever need to look at it twice?" (yes → log). Get those two right and the rest is tuning.

The major systems — with when-to-use, when-NOT, and the trade-off vs the named alternative

RabbitMQ — the smart queue / router

A mature AMQP broker whose exchanges (direct, topic, fanout, headers) do routing inside the broker. Push-based delivery with per-message acks, dead-letter queues, TTLs, and priority queues.

Apache Kafka — the distributed log

Partitioned, replicated, append-only commit log. Producers key records to partitions; consumers in a group split partitions among themselves and commit offsets. Retention is time/size-based, independent of consumption.

Amazon SQS — the managed queue you never operate

Fully managed, effectively infinite-scale queue. Standard queues are at-least-once with best-effort ordering; FIFO queues add strict per–message-group ordering and a content-based deduplication window (not free exactly-once side effects — make consumers idempotent). No brokers to run; pay per request.

Apache ActiveMQ — the JMS workhorse

A multi-protocol broker (JMS, AMQP, STOMP, MQTT, OpenWire) strong in Java/enterprise-integration settings. Classic ActiveMQ is queue-oriented; ActiveMQ Artemis is the modern high-performance engine.

NATS — the lightweight cloud-native broker

NATS is a fast, simple messaging layer built for cloud-native workloads where operational overhead is the enemy. The core server is a single binary; it speaks publish-subscribe and request-reply out of the box and can route messages across a cluster with no leader election ceremony.

Apache Pulsar — the tiered-storage log

Pulsar separates compute (brokers) from storage (Apache BookKeeper), which lets you scale message ingestion independently from storage. It supports both streaming (durable, rewindable) and queuing (ack-and-delete) models in one system, and it can offload old segments to object storage like S3 for effectively infinite retention.

Traced example: two workloads through the same lens

Watch how the mechanism forces the choice with concrete numbers.

Workload 1 — Order-confirmation emails (a task)

An e-commerce checkout emits 2,000 orders/min ≈ 33 msg/s. Each message triggers exactly one email. Emails must not be sent twice, but never need re-reading, and no other team consumes them.

Workload 2 — Clickstream events (an event)

A site emits 500,000 clicks/min ≈ 8,300 msg/s. Three independent teams want them: real-time analytics, the search-ranking model, and a fraud audit trail. Analytics occasionally needs to reprocess the last 3 days after a bug fix.

Same rubric, opposite answers — because one workload is a task and the other is a retained, multi-reader event stream.

Production failure modes worth knowing before you commit

Notice the through-line: the queue systems fail on per-message state and redelivery; the log fails on partitioning and rebalance. That's the mechanism reasserting itself — and it's why picking on mechanism first, product second, is the durable skill.

Sources

Queue vs log vs pub/sub decision flowchart

Delivery honesty: classic queues (RabbitMQ, ActiveMQ, SQS) are at-least-once by default. None of them give “exactly-once processing out of the box.” Effectively-once is usually at-least-once delivery + idempotent consumers (and, where offered, broker-side dedup windows such as SQS FIFO’s content-based deduplication — still not a free lunch for side effects).

Need durable replay / high fan-out / long retention?
    YES  -> log broker (Kafka / Pulsar)
    NO   -> need durable task dispatch + flexible routing / per-message acks?
              YES -> classic message queue (RabbitMQ / ActiveMQ)  // at-least-once; make consumers idempotent
              NO  -> need sub-millisecond pub/sub simplicity?
                       YES -> NATS (add JetStream only if you need persistence)
                       NO  -> managed queue (SQS / Azure Service Bus)  // also at-least-once by default
Workload signalLean towardWhy
Replay, retention, stream processingKafka / PulsarDurable ordered log; multiple consumer groups
Complex routing, per-message acksRabbitMQExchanges, queues, DLX, priority
Low-latency control planeNATSLightweight pub/sub, no persistence by default
Geo-replicated, tiered storagePulsarUnified queuing/streaming, decoupled storage

Drill ladder: queue vs log

🤖 Don't fully get this? Learn it with Claude

Stuck on Popular Messaging Queue Systems? Open Claude, copy a block below, and it'll teach you this exact concept — visually and interactively.

🎨 Explain it visually

Build the mental picture, not memorization.

I just read a lesson on **Popular Messaging Queue Systems** (System Design) and want to truly understand it. Explain Popular Messaging Queue Systems from first principles using ONE vivid real-world analogy and a visual mental model — draw it as ASCII art or a clear step-by-step diagram — with a concrete example using real numbers. Then ask me one question to check I got the mental picture, and wait for my reply. If you're unsure or a claim isn't standard, say so and reason from first principles instead of guessing.
🤔 Walk me through it (interactive)

Socratic — adapts to where you're stuck.

Teach me **Popular Messaging Queue Systems** interactively. Ask me ONE guiding question at a time, wait for my answer, and adapt to my confusion — build the idea with me step by step instead of explaining it all at once. If you're unsure or a claim isn't standard, say so and reason from first principles instead of guessing.
🧪 Quiz me & fix my gaps

Active recall exposes what you missed.

Quiz me on **Popular Messaging Queue Systems** with 5 questions, easy to tricky, ONE at a time. Tell me if each answer is right; at the end, explain clearly what I got wrong and why. If you're unsure or a claim isn't standard, say so and reason from first principles instead of guessing.
🧠 Make it stick

Intuition + hook + flashcards for long-term memory.

Help me remember **Popular Messaging Queue Systems** for the long term: give the one-sentence intuition, a memorable hook/mnemonic, a tiny worked example, and 3 active-recall flashcards (Q -> A). If you're unsure or a claim isn't standard, say so and reason from first principles instead of guessing.

📝 My notes