TechCoder.io / System Design

Message Queues: Kafka, RabbitMQ & SQS

Master Apache Kafka architecture (topics, partitions, consumer groups, offsets), RabbitMQ exchanges and routing, AWS SQS, at-least-once vs exactly-once delivery semantics, and Dead Letter Queues for production async messaging systems.

By TechCoder TeamLast updated: 2026-10-17
In a Nutshell

Master Apache Kafka architecture (topics, partitions, consumer groups, offsets), RabbitMQ exchanges and routing, AWS SQS, at-least-once vs exactly-once delivery semantics, and Dead Letter Queues for production async messaging systems. This hands-on tutorial focuses on practical implementation of message queues: kafka, rabbitmq & sqs concepts.

Message Queues: Kafka, RabbitMQ & SQS

Message queues decouple producers (who create work) from consumers (who process work). Instead of Service A calling Service B directly and waiting for a response, A puts a message in a queue and B processes it when ready. This enables async communication, load leveling, and resilience.

[!IMPORTANT] Message queues solve the "slow consumer" problem: if your payment processing service takes 5 seconds per transaction but you're receiving 10,000 transactions/second, you need a queue to buffer the load. Without it, your upstream API would either timeout or need 50,000 payment processing servers.

Message Queue vs Event Streaming

Message QueueEvent Streaming
ConsumptionMessage deleted after consumedRetained (replayed by multiple consumers)
ConsumersCompete for messages (one winner)Independent consumer groups
RetentionUntil consumedDays to forever
Use caseTask queue, work distributionEvent log, analytics, ML pipelines
ExamplesRabbitMQ, AWS SQSApache Kafka, AWS Kinesis

Apache Kafka Deep Dive

PYTHON PLAYGROUND
⏳ Loading editor…

Delivery Semantics

PYTHON PLAYGROUND
⏳ Loading editor…

Quiz

Quiz

Question 1 of 2

You use Kafka to process payment events. User 123 has 3 events in order: 'payment_initiated', 'payment_processing', 'payment_completed'. What must be true to guarantee these 3 events are processed in order?

They must be on separate partitions — one per event
They must use the same partition key (e.g., user_id=123) so they land on the same partition
Kafka automatically orders all events by timestamp

Key Takeaways

✅ Message queues (RabbitMQ, SQS) are for task distribution; event streaming (Kafka) is for event logs readable by multiple independent consumers.
✅ Kafka partition key determines which partition a message lands on — use a key that guarantees ordering for related events (e.g., user_id).
✅ At-least-once is the default — make consumers idempotent (safe to process the same message twice).
✅ Dead Letter Queues prevent poison messages from blocking entire queues — always configure DLQs in production.
✅ Multiple consumer groups can read the same Kafka topic independently — analytics, ML training, and search indexing can all consume the same event stream.

Official Resources

What's Next?

Message queues decouple services — now let's explore the full architectural pattern that leverages them.
Next: Event-Driven Architecture & CQRS — Event sourcing, CQRS pattern, and Saga for distributed transactions.