Idempotent & Transactional Producers

From 'no duplicates per partition' to 'all-or-nothing across topics'.

0/5 done

From idempotence to EOS

Idempotent vs transactional

  • Idempotent producer — sequence numbers per (producer-id, partition); broker drops duplicates on retry. Per-partition guarantee.
  • Transactional producer — transactional.id + initTransactions() + beginTransaction() / commitTransaction() / abortTransaction(). Atomic writes across multiple partitions and the consumer-offsets topic. This is what unlocks exactly-once stream processing (read → process → write).

Pair with consumers set to isolation.level=read_committed so they skip aborted records.

Transactional read-process-write (Python)

Read from orders, enrich, and write to orders.enriched and orders.audit atomically. If anything throws, the transaction is aborted and no downstream consumer ever sees the partial output.

Idempotent producer in Go (segmentio/kafka-go)

Mirror the same shape in Go. segmentio/kafka-go exposes idempotence via Writer.AllowAutoTopicCreation/RequiredAcks and the underlying transport. Key requirements: RequiredAcks: RequireAll, balancer keyed on OrderId.

Reading in progress · 0 of 5 activities done