📨 Apache Kafka Intermediate

What is Debezium and how does it work with Kafka?

Answer

Debezium is an open-source CDC (Change Data Capture) platform that captures row-level changes from databases (MySQL, PostgreSQL, MongoDB, Oracle, SQL Server) and streams them as events to Kafka topics. How it works: Debezium connects to the database's transaction log (binlog for MySQL, WAL for PostgreSQL, oplog for MongoDB) and reads every INSERT, UPDATE, and DELETE event. Each change event is published to a Kafka topic (one topic per table by default) with the full before/after row image, operation type, timestamp, and transaction ID. This enables: Event-driven architecture (react to DB changes without polling), CQRS (build read models from write events), Cache invalidation, Microservice sync. Debezium runs as a Kafka Connect source connector — deploy on a Connect cluster and configure with the database connection details.