← 📊 Data Science

📨 Kafka Topic Log

Consumer A (real-time)
Consumer B (lagging)
Events produced: 0
Consumer B lag: 0
Offset resets: 0
FPS:
Drag — rotate · Scroll — zoom

📨 Apache Kafka and Event-Driven Architecture

Producers write events onto a partitioned, append-only Kafka topic log while two independent consumers replay it at their own pace — watch a lagging consumer fall behind and get reset when it drops outside the retention window.

🔬 What It Demonstrates

Each partition is an ordered, offset-indexed log. Consumers never remove data — they just track a read offset, so a fast consumer and a slow one can read the exact same log independently, which is the essence of event-driven decoupling.

🎮 How to Use

Adjust the partition count, producer rate and the slow consumer's processing speed. Shrink the retention window or starve Consumer B to watch its offset expire and reset — a real Kafka failure mode called an offset out-of-range reset.

💡 Did You Know?

Kafka can sustain millions of events per second because partitions parallelize both writes and reads — each partition is only ever appended to by one producer thread and read independently by each consumer group.