Intermediate

Stream Processing with Kafka

Stand up a KRaft-mode Apache Kafka broker (no ZooKeeper), write a producer and a consumer group, and implement exactly-once-style processing with manual offset commits and idempotent writes.

~2.5h
0 / 7 steps
🚀
Intro

Before We Start

Prerequisites: Docker and Docker Compose, and Python 3.10+.

Kafka 4.0 (released 2025) made a change that's easy to miss if you learned Kafka from an older tutorial: ZooKeeper isn't deprecated, it's removed entirely. Kafka 4.x runs exclusively in KRaft mode, where the metadata quorum lives inside Kafka itself via Raft consensus among controller nodes, instead of a separate ZooKeeper cluster. If a setup guide still shows a zookeeper: service in its Docker Compose file, it's describing a pre-4.0 architecture.

You'll run a single-node KRaft broker, write a Python producer that publishes order events to a topic, and a consumer group that processes them with manual offset commits — the pattern that gives you control over exactly when a message is considered "done" rather than trusting Kafka's auto-commit timer.

🔨

Run Kafka 4.x in KRaft mode with Docker

🔨

Write a producer

🔨

Write a consumer group with manual commits

🔨

Scale the consumer group

🎯
Secret Mission

Secret Mission: Build a dead-letter queue

🧹
Wrap Up

Before You Go

Pro

Test what you just learned

Self-testing is one of the best ways to retain new skills. Unlock project quizzes to check your understanding.

Log in to unlock