Question 39 of 50
What is At Least Once?
Question
"What is the At Least Once guarantee, and why is it so common in financial systems?"
What the interviewer wants to assess
Whether you understand at-least-once not as an "almost perfect" guarantee, but as a deliberate choice that requires a specific trade-off (idempotency) to work well in production.
Resposta rápida
At Least Once means the message is never lost, but it can be delivered more than once. It happens when the commit (or the producer's retry) only occurs after the previous step has been confirmed, accepting reprocessing in case of a failure between the confirmation and recording it.
Resposta nível Sênior
It's the most-used practical default in financial systems because, between losing and duplicating,
duplicating is the more manageable risk: a duplicated message is detectable and fixable with idempotency
(Chapter 11), while a lost message doesn't even leave a trace. In practice, this means acks=all on the
producer (with retry) and manual commit on the consumer, done only after processing finishes successfully
— if the consumer crashes between the end of processing and the commit, the message is redelivered on the
next startup, and it's idempotent processing that guarantees that redelivery doesn't duplicate the business
effect.
In-depth explanation
See "At Least Once" in Chapter 10 and the full idempotency pattern in Chapter 11.
Exemplo financeiro
The notificacao-service runs with At Least Once: if it crashes after sending the notification but before
committing the offset, the notification may be sent twice — acceptable for this flow, and mitigable if
needed with an idempotency check.
"At Least Once guarantees the message is processed exactly once, just more safely"
No — At Least Once explicitly allows duplication. Anyone who needs true single processing needs to add idempotency on top (or use exactly-once semantics within Kafka's scope).
Pode vir a seguir
Likely follow-ups: "what is Exactly Once?" and "how would you avoid duplicate processing?".
Related chapters