# What is at-least-once delivery?

> At-least-once delivery means the broker keeps redelivering a message until the consumer acknowledges it. The message is never lost, but it can arrive more than once. So the consumer must tolerate duplicates, and exactly-once effects come from an idempotent consumer on top.

- Author: Zeeshan Adil (https://www.internalswithzee.com/about)
- Published: 2026-11-12
- Source: https://www.internalswithzee.com/concepts/at-least-once-delivery

## The problem it solves

A message can be delivered and processed but never acknowledged, because the consumer crashes before it replies or the reply is lost. The broker cannot tell "never arrived" from "arrived, ack lost". It has two choices: forget the message and risk losing it, or send it again and risk a duplicate. At-least-once picks the second.

## How it works

The broker keeps the message until the consumer acknowledges it. If the acknowledgement never comes, it delivers the message again.

```
broker -> consumer   message 42
consumer             does the work, then crashes before the ack
broker               no ack, so it delivers message 42 again
```

At-most-once is the opposite trade. The broker hands the message over and forgets it (automatic acknowledgement), so a crash mid-work loses the message, but nothing is ever duplicated.

"Exactly-once" is easy to promise and hard to deliver. In practice it means at-least-once delivery plus an idempotent consumer: the message may arrive twice, but the effect happens once. The usual tool is a stable id per logical event, recorded under a unique constraint in the same transaction as the effect. A retry then finds its own record and does nothing.

## What it does not do

- **It does not prevent duplicates.** It trades them for no loss. Every consumer must handle seeing a message twice.
- **It does not cover the sender's side.** A producer that publishes and crashes before recording it will publish again. A [transactional outbox](/concepts/transactional-outbox) gives at-least-once publishing, not exactly-once.
- **It cannot make an outside action happen once.** Sending an SMS or charging a card crosses a boundary the broker cannot see. The provider has to deduplicate, for example through an [idempotency key](/concepts/idempotency-key).

## Measured

In my [sharding challenge](/challenges/distributed-systems/where-does-each-comment-live), 100 writes were made whose reply was lost after the commit, so the API retried.

| Retry carries | Writes asked | Rows stored | Duplicates |
|---|---|---|---|
| the same request id | 100 | 100 | 0 |
| nothing, it starts over | 100 | 200 | 100 |

In the [one message per action challenge](/challenges/distributed-systems/one-message-per-action), 2,000 actions went through workers killed 200 times at random, a database restart, and a provider that dropped requests and replies and repeated webhooks. Checked against the provider's own log, 2,000 of 2,000 actions had exactly one effect. Every retry was preceded by a lookup and reused the original key.

## Related

- Challenge to run: https://www.internalswithzee.com/challenges/distributed-systems/one-message-per-action
- Article: https://www.internalswithzee.com/blog/message-queue-patterns
- Article: https://www.internalswithzee.com/blog/resilient-jobs-unreliable-apis
- Related concept: https://www.internalswithzee.com/concepts/idempotency-key
- Related concept: https://www.internalswithzee.com/concepts/transactional-outbox
- Related concept: https://www.internalswithzee.com/concepts/fencing-token

## Sources

- [RabbitMQ docs, Reliability Guide](https://www.rabbitmq.com/docs/reliability)
- [Stripe API docs, Idempotent requests](https://docs.stripe.com/api/idempotent_requests)

