Part 2 6 chapters

Getting events out reliably

The transactional outbox, Debezium change data capture, idempotent consumers and delivery guarantees.

Chapter 8

Transactional outbox

An order and the event that announces it are two writes to two systems. The outbox turns them into one transaction in the database and lets the transaction log carry the event to Kafka.

45 minutesRead โ†’
Chapter 9

Log tailing with Debezium

Reading a database's transaction log turns every committed change into an event without touching the application: slots, snapshots, replica identity, tombstones, heartbeats and the embedded engine.

50 minutesRead โ†’
Chapter 10

Managing connector offsets

A source connector remembers its place in the database log. Stopping it, reading that place, moving it forward, resetting it and recovering a lost replication slot, with what PostgreSQL does to each.

45 minutesRead โ†’
Chapter 11

Idempotent consumer and inbox

Kafka delivers an event at least once, and a decrement is not safe to repeat. The inbox records the event id in the same transaction as the effect, so a duplicate record and a redelivery after a crash change nothing.

45 minutesRead โ†’
Chapter 12

Exactly-once with Kafka transactions

A service that reads a record, processes it and writes a result can crash between the write and the offset commit. A Kafka transaction holds the output records and the input offsets together, and a read_committed reader never sees half of it.

50 minutesRead โ†’
Chapter 13

Retry and dead letter

A consumer meets three kinds of bad record: one that never parses, one that is never valid and one that fails only while a row is locked. Retry the third, dead-letter the first two, and keep their original bytes.

45 minutesRead โ†’