Message delivery has levels:
At-most-once: Fire and forget. May lose messages.
At-least-once: Retry until confirmed. May duplicate.
Exactly-once: Each message processed once. Hard to achieve.
Kafka supports exactly-once through:
- Idempotent producers: Automatic deduplication
- Transactions: Atomic writes across partitions
- Consumer offset commits: Tied to processing
In practice, many systems use at-least-once with idempotent consumers. Simpler and often sufficient. Know the tradeoffs for interviews.