Kafka Explained Simply: Topics, Producers, Consumers
Kafka is a super-fast message queue that never forgets. Here's the mental model in plain English.
Series
Learn Kafka
What is Kafka?
Kafka is a distributed log — imagine a giant, ever-growing notebook that many writers add to and many readers read from, in order.
The three actors
Producer ----> [ Topic: orders ] ----> Consumer(s)
- Producer — writes messages to a topic.
- Topic — a named log (e.g.
orders,payments,logs.error). - Consumer — reads messages, at its own pace.
Partitions and offsets
A topic is split into partitions (usually 3-30). Each partition is an ordered, append-only log. Every message has an offset — a monotonically increasing number.
Topic: orders
├── Partition 0: [0][1][2][3][4] ...
├── Partition 1: [0][1][2][3]
└── Partition 2: [0][1][2][3][4][5]
Consumers remember their offset — they can rewind or fast-forward.
Real-world example
At an e-commerce site:
- Checkout service publishes
order-placedevents. - Inventory service consumes them and decrements stock.
- Email service consumes the same events and sends a receipt.
- Analytics service consumes them for dashboards.
One producer, many independent consumers, all working from the same log.
When not to use Kafka
- Request/response APIs (use HTTP).
- Small volumes on a single machine (use RabbitMQ or SQS — simpler).
- You need queries and joins (use a database).
Keep reading
You may also like
programming
Kafka Beyond Basics: Consumer Groups, Replication, Ordering
The three intermediate concepts that turn Kafka from a toy into a production tool.
programming
Python Async: A Practical Guide
asyncio, event loops and when NOT to use async.
programming
React 19 useOptimistic Explained
The new hook that makes optimistic UI trivial — with a working example.
Discussion (0)
No comments yet. Be the first to weigh in.