Kafka transaction
A Kafka transaction is an atomic operation that groups record production and related offset commits so their effects are committed together or aborted.
Kafka Streams in Action, Second Edition
A Kafka transaction is an atomic unit that groups record production and related offset commits so they either all succeed or all abort.
- How it is used
- Ensures exactly-once processing when producing records, especially across partitions or during consume-transform-produce flows.
- How deep it goes
- Walks through producer initialization, transaction control, consumer isolation, last stable offsets, and transactional offset commits, while deferring transaction design internals.
- Examples
- Uses a financial duplicate-prevention scenario and a stock compliance-reporting consume-transform-produce application with TopicPartition offsets.
- What you can do after
- Build it from scratch with KafkaProducer transaction calls, read_committed consumers, and sendOffsetsToTransaction() for atomic processing.
Read how Kafka Streams in Action, Second Edition explains Kafka transaction →
Apache Kafka in Action
A Kafka transaction is an atomic operation that groups message writes and related offset commits so they either all succeed or all roll back.
- How it is used
- Supports consistent Kafka-to-Kafka processing by grouping output writes and consumer offsets atomically.
- How deep it goes
- Explains the producer lifecycle, transaction coordinator, commit and abort markers, and consumer visibility.
- Examples
- Demonstrates an account transfer with a Python producer and compares database offset storage with idempotent writes.
- What you can do after
- Apply it via confluent-kafka to commit multiple writes atomically, and configure consumers to read only committed messages.
Read how Apache Kafka in Action explains Kafka transaction →
Kafka for Architects
A Kafka transaction is an atomic operation that groups record production and related offset handling so their effects can be committed or aborted together.
- How it is used
- Coordinates read-process-write pipelines whose outputs must remain consistent across retries, failures, and multiple Kafka topics.
- How deep it goes
- Defines the Kafka-specific exactly-once model and consumer isolation, without providing a low-level implementation walkthrough.
- Examples
- Uses an OrderService that reads ORDERS and writes SHIPMENTS, BILLING, and INVENTORY atomically.
- What you can do after
- Apply Kafka transactions to read-process-write workflows requiring exactly-once results across multiple output topics.
What to know first
- topicA topic is a named channel or stream that organizes messages or records for publication and retrieval by interested consumers.
- clientA client is a person, organization, or software component that requests, receives, or uses a product, service, or capability provided by another party or system.
- Kafka producerA Kafka producer is an application or client that publishes records to Kafka topics.
- offsetAn offset is a position or displacement measured relative to a reference point, such as within an ordered sequence, memory region, or layout.
Related concepts
- isolationhas part · Isolation is the separation of a component, process, resource, or context from others to limit interaction, interference, or exposure.
- atomicityhas part · Atomicity is the property that an operation or group of operations takes effect as an indivisible whole, without observable partial effects.
- exactly-once deliveryaddresses · Exactly-once delivery is a processing guarantee that each message or operation produces one intended effect, without loss or duplicate effects, including across retries or failures.
- producer idempotenceuses · Producer idempotence is a Kafka delivery property that makes producer retries safe from creating duplicate records while preserving record ordering.
Questions about Kafka transaction
What is Kafka transaction?
A Kafka transaction is an atomic operation that groups record production and related offset commits so their effects are committed together or aborted.
Which Manning books explain Kafka transaction?
Kafka Streams in Action, Second Edition, Apache Kafka in Action and Kafka for Architects.
What should I know before learning Kafka transaction?
Manning books that teach Kafka transaction usually introduce topic, client, Kafka producer and offset first.
What are the parts of Kafka transaction?
Kafka transaction includes isolation and atomicity.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.


