Skip to content
Kafka Is Fun

Lesson 4 of 5

Producer Transactions

1 min read

Overview

Kafka transactions allow atomic writes across multiple partitions and topics. A transactional producer sets transactional.id, which also implies idempotence, and if a producer restarts with the same ID, a transaction left open by the earlier instance is aborted. Consumers with isolation.level=read_committed return only committed transactional messages and filter out aborted ones; messages after an open transaction are held back until it completes, because the consumer is limited to the last stable offset. Transactions are what Kafka Streams uses for exactly-once processing, and the transactional producer and a read_committed consumer can also be used directly for read-process-write cycles on Kafka topics.

Key configuration

Settingsproperties
transactional.id=my-producer-v1 — unique per producer instance
transaction.timeout.ms — how long a transaction can stay open before the coordinator aborts it
isolation.level=read_committed — consumer side; the default is read_uncommitted
enable.auto.commit=false — consumer side, required for exactly-once consumption

Production tip

Check yourself

A transactional producer crashes mid-transaction and restarts with the same transactional.id. What happens to the pending transaction?

Sources

Checked against Kafka 4.2 documentation on Oct 2026. Draft: not yet reviewed by a Kafka specialist. Releases move on, so confirm against the current documentation before you act on a number.

Try it in the simulator

Guided scenarios for this module — the simulator opens with the exercise already running.

Prefer a picture? Open the live cluster in 3D and watch records move between producer, brokers and consumers.

Browse all troubleshooting entries