All labs
Lab 10
Event-Driven

Life of a Message โ€” Queue vs Pub/Sub vs Stream

Drop the same event into all three and watch what's left afterward: a queue deletes it, pub/sub forgets offline subscribers, and a stream keeps it on a replayable log with offsets and consumer groups.

The same event is dropped into all three at once โ€” watch what survives.

Queue

one worker, then deleted
โš™๏ธ
Worker 1
0
โš™๏ธ
Worker 2
0
Messages remaining after consume: 0

One event โ†’ one worker. After it's processed the broker deletes it. No copy, no replay.

Pub / Sub (Topic)

all live subscribers, then gone
โœ‰๏ธ Email
0โœ“
๐Ÿ“ฑ SMS
0โœ“
๐Ÿ“ˆ Analytics
0โœ“

Each online subscriber gets its own copy. Toggle one offline, emit, and it misses the event โ€” no way to get it back.

Stream (Kafka)

durable log + replay
Append-only log (offsets)
empty log
Group A ยท Analyticsat offset 0
Group B ยท ML-trainingat offset 0

Events are kept. Each group reads at its own offset; replay re-reads history. Offline consumers catch up later.

What just happened