Monedula
Kafka guide contents

Markdown

Part VI · Reference

Kafka Improvement Proposal

KIP-98: exactly once with the idempotent producer and transactions

Producers and transactions · Shipped · since Kafka 0.11 · status checked November 2026

KIP-98 gave Kafka two things. The idempotent producer lets the broker spot a retried batch and drop the copy, so a lost acknowledgement no longer means a duplicate. Transactions let a producer write to several partitions and commit or abort them together, so a read_committed consumer sees all of it or none.

Proposal
KIP-98, Exactly Once Delivery and Transactional Messaging
Status
Shipped Since Kafka 0.11 (2017). Idempotence is on by default since Kafka 3.0.
Area
Producers and transactions
Lost ack → p-idem re-sends seq 0 → DEDUPED (no second write). Idempotence: the broker recognises the already-committed sequence and acks without appending. Still one record. Open this step in the full playground

Why it was needed

Before KIP-98, a producer that sent a batch and never heard back had two bad choices. Retry, and risk writing the same records twice if the first write had in fact succeeded. Or give up, and risk losing them. Stream processing made it worse: an app that reads, processes and writes could crash between writing its output and committing its input offsets, and on restart it would produce the same output again.

What it changes

Every idempotent producer gets a producer id, and every batch it sends to a partition carries a sequence number. The broker remembers the last sequence numbers per producer and partition, so a retry of a batch it already has is acknowledged without a second write. Transactions build on that: a transactional.id ties the producer to a transaction coordinator, the producer marks which partitions it writes to, and commit or abort writes a marker into each of them. Consumers with isolation.level=read_committed only read up to the last stable offset, so they never see records of an open or aborted transaction.

How to use it

  • Idempotence needs nothing on Kafka 3.0 or newer: enable.idempotence=true and acks=all are the defaults.
  • For transactions, set transactional.id on the producer and wrap sends in beginTransaction() and commitTransaction(); set isolation.level=read_committed on the consumers that must not see aborted data.

Where it stands

Shipped in Apache Kafka 0.11 in 2017 and part of every release since. KIP-679 made idempotence the producer default in Kafka 3.0. Transactions stay opt-in, because they need a transactional.id and read_committed consumers.

What comes next

The design keeps evolving through follow-up KIPs. KIP-447 made exactly-once stream processing scale, and KIP-890 hardened transactions on the broker side against hanging and zombie transactions: part one shipped in Kafka 3.6, and part two, a new transaction protocol that bumps the producer epoch on every transaction, is on once a cluster finishes its upgrade to Kafka 4.0.

See it in the simulator

Sources

All Kafka KIPs