Messaging systems · a hands-on lesson

One message.
Who actually gets it?

Apps talk to each other by sending messages. But there are two very different ways to deliver them. A Queue hands each message to one worker. A Topic broadcasts each message to everyone who's listening. That single difference changes everything — let's see it move.

RabbitMQ → Queue Kafka → Topic Try the simulator ↓
01

See the difference move

Press Send a message. The same message goes into both systems at once. Watch where it ends up — and count who receives it.

Messages sent: 0

RabbitMQ Queue

Workers compete for messages. Each message is grabbed by just one worker, then it's gone. Great for splitting up jobs.

Waiting in line
Workers (each handles a share)
Worker A
0
handled
Worker B
0
handled
Worker C
0
handled
Total messages handled across all workers: 0. Notice: this equals the number sent — each message is done once.

Kafka Topic

Every subscriber gets its own copy of every message — and the messages are kept in a log you can re-read later.

Just arrived
Subscribers (everyone gets a copy)
Search app
0
received
Analytics
0
received
Email bot
0
received
Saved log (history stays)
Nothing yet — send a message.
Each subscriber's count grows by 1 per message, and nothing is deleted. History can be replayed.
💡
The big idea in one line: a Queue splits work (one message → one worker), while a Topic shares news (one message → all subscribers, and it's saved).
02

Think of it like real life

Same idea, no code. These two everyday things behave exactly like a Queue and a Topic.

🎟️
Queue = the deli counter

Take a number, one server helps you

You grab a ticket and wait. When a worker is free, they call one number and serve that one person. More workers = the line moves faster, but each order is still handled once. When you're served, your ticket is done and thrown away.

🎙️
Topic = a podcast / group chat

Post once, everyone subscribed hears it

You publish one episode. Every subscriber gets it — the search app, your friend, and the analytics all receive the same thing. And it's recorded: someone who joins later can scroll back and replay old episodes.

03

Pros & cons, side by side

Neither one is "better." They're built for different jobs. Here's the honest scorecard.

What we're comparing
RabbitMQ — Queue
Kafka — Topic
Who gets a message?
One worker takes it
Every subscriber gets a copy
After it's read…
Removed from the queue
Kept in a log; can replay
Best superpower ✅
Splitting work fairly across many workers
Broadcasting + keeping full history
Watch out for ⚠️
Once read, the message is gone — hard to re-read later
More to set up; overkill if you just need a simple to-do list
Order of messages
Good for task-by-task work
Strong ordering, built for huge streams
Think of it as…
A to-do list many helpers share
A recorded broadcast channel
04

The trade-off: which should you pick?

Answer these three questions about your project. The needle will lean toward the better fit as you go.

1. Should each message be done by just one worker, or does everyone need it?

2. Do you need to keep old messages and replay them later?

3. Is your project more about sharing out tasks, or streaming lots of events?

Recommended fit
Answer to see
◀ QueueTopic ▶
Pick an option in each question. There's no single right answer — it depends on what your app needs to do.
05

Where each one shines

Real situations you can picture. Notice how "one worker" vs "everyone gets it" decides the winner.

QUEUE fits

Sending order confirmation emails

1,000 orders come in. Each email should be sent once. Share the load across 5 email workers so no customer gets two emails and none get missed.

QUEUE fits

Resizing uploaded photos

Users upload pictures that each need shrinking. Drop each job in the queue; whichever worker is free grabs the next photo. Pure task-sharing.

TOPIC fits

A new video is posted

One "new video" event, but the search index, the recommendation system, and the notification service all need to know. Broadcast it once; each subscriber reacts its own way.

TOPIC fits

Tracking every click for analytics

A firehose of "user did X" events. Keep the full history so teams can replay it, build charts today, and re-run new analysis on old data next month.

06

Check yourself

Three quick questions. Tap an answer to see if you've got it.