Overview
Messages are not lost once committed, but may be delivered more than once. The design page says Kafka guarantees at-least-once delivery by default: a committed message is not lost as long as one broker that replicates the partition stays alive, and acks=all with an adequate min.insync.replicas (the design page suggests 2 with a replication factor of 3) is what makes the producer wait for that. Redelivery happens, for example, when the network fails after the broker writes a message but before the acknowledgement returns and the producer retries without idempotence, or when a consumer processes a record before saving its position and then crashes. Idempotence is on by default in Kafka 4.2, so producer-retry duplicates need enable.idempotence=false to be set explicitly. Consumers have to tolerate duplicates.
Key configuration
acks=all
enable.idempotence=false # explicit: idempotence is on by default in 4.2
enable.auto.commit=false # consumer: process first, then commit
// Consumer: tolerate duplicates, for example with upserts keyed by a primary keyProduction tip
Check yourself
Why can at-least-once delivery produce duplicates?
Sources
- Design (4.2 documentation) (opens in a new tab)
- Producer configs (4.2 documentation) (opens in a new tab)
- KafkaProducer Javadoc (4.2) (opens in a new tab)
- KafkaConsumer Javadoc (4.2) (opens in a new tab)
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.