Senior
Between which elements do Kafka delivery guarantees work?
sobes.tech AI
Answer from AI
Delivery guarantees in Apache Kafka operate between the producer, broker, and consumer. The main types of guarantees:
- At most once — a message may be delivered 0 or 1 times, without retries, possible data loss.
- At least once — a message is delivered at least once, duplicates may occur.
- Exactly once — a message is delivered exactly once, with no loss or duplication.
These guarantees are ensured through interactions:
- Between the producer and broker: write acknowledgments (acks), retries.
- Between the broker and consumer: offset control, processing acknowledgments.
For example, the exactly-once semantics use an idempotent producer and transactions to guarantee atomicity of message writing and processing.