DB → log → Kafka
Why CDC
Change-Data-Capture (Debezium) tails the database's transaction log (MySQL binlog, Postgres WAL, SQL Server CDC tables) and emits one Kafka record per row change. Benefits over dual-writes:
- No outbox needed for read-only consumers — the DB is the source of truth.
- Atomic with the transaction (you can't drift).
- Replay from any LSN — perfect for rebuilding caches, search indexes, vector stores.
Pair with the outbox pattern when you need to emit domain events (not raw row changes) atomically with state writes.