What do at-most-once, at-least-once and exactly-once mean?
Short answer
At-most-once can lose messages, at-least-once can process them twice, exactly-once means the final effect is as if each message were processed once. The default choice is at-least-once + an idempotent consumer.
3 points to say:
- At-most-once: commit first, process later, a crash loses it; at-least-once: the reverse, a crash repeats it.
- True exactly-once needs state and offset in one transaction: Kafka transactions, or storing the offset in the same DB transaction.
- Default to at-least-once + idempotency; external side effects (email, payment APIs) need an idempotency key.
Keep reading the deep dive
Create a free account to read the full explanation and follow-up questions, mark questions as studied and review them on a schedule.