At-least-once delivery is a message delivery guarantee under which every message or event is delivered to its consumer one or more times, so that nothing is lost even when components fail, but the same message may be processed repeatedly. In streaming data systems, it is the most common default guarantee offered by message brokers and stream processors, because it protects completeness at a modest cost.
The guarantee rests on a simple rule: a message is considered done only after the consumer explicitly acknowledges it. Until that acknowledgment arrives, the producer or broker keeps the right to resend. The price of this safety is the possibility of duplicates, which downstream logic must tolerate or remove.
How at-least-once delivery prevents data loss
At-least-once delivery works by combining durable storage, acknowledgments and retries. A producer sends a record and waits for the broker to confirm that the record is persisted. If no confirmation arrives within a timeout, the producer sends the record again. On the consuming side, the consumer processes the record first and commits its position or acknowledgment afterward.
The ordering of the last two steps is the core of the guarantee. If a consumer crashes after processing but before committing, it restarts from the last committed position and processes the same records again. No record is skipped, yet some records are handled twice. Reversing the order, committing first and processing second, gives at-most-once behavior instead.
The table below shows where duplicates arise along a typical event path.
| Failure point | What happens | Resulting duplicate |
|---|---|---|
| Lost producer acknowledgment | Broker stored the record, but the reply was lost | Producer retry writes a second copy |
| Consumer crash before commit | Records processed, offset not saved | Batch is reprocessed after restart |
| Rebalance in a consumer group | Partition moves to another consumer | Uncommitted records are read again |
| Visibility timeout expiry | Slow processing exceeds the lease | Queue redelivers to another worker |
Delivery guarantees compared
At-least-once delivery sits between two other guarantees, and the choice among them is a trade-off between completeness, duplication and cost. Each guarantee describes what happens under failure, not under normal operation, when all three behave identically.
| Guarantee | Data loss | Duplicates | Typical cost |
|---|---|---|---|
| At-most-once | Possible | None | Lowest latency and overhead |
| At-least-once | None | Possible | Retries and idempotent consumers |
| Exactly-once semantics | None | None in effect | Transactions, coordination and higher latency |
A frequent misconception is that exactly-once semantics removes retries. In practice, exactly-once is usually at-least-once delivery plus deduplication or transactional commits, so that repeated deliveries have no repeated effect. Exactly-once guarantees also tend to hold only inside one system boundary, such as a broker and a stream processor; side effects in external databases or APIs still need their own protection.
Making consumers safe for duplicates
Because duplicates are expected, the decisive design property under at-least-once delivery is idempotent processing: handling the same message twice must leave the system in the same state as handling it once. Teams that design for idempotency early rarely need stronger guarantees.
The following table lists the standard techniques and when each fits.
| Technique | How it works | Best fit |
|---|---|---|
| Idempotency key | Store each processed message ID and skip repeats | Payments, orders and notifications |
| Upsert by natural key | Insert or overwrite the same row | State tables and dimension updates |
| Conditional write | Apply only if the version or sequence is newer | Counters and concurrent updates |
| Windowed deduplication | Remove repeated IDs within a time window | High-volume event streams |
| Transactional outbox | Write state and output in one transaction | Services publishing derived events |
Some operations are naturally idempotent, such as setting a status to shipped, while others are not, such as incrementing a balance or sending an email. Non-idempotent operations require an explicit deduplication store, and its retention period must exceed the longest plausible redelivery delay.
Configuring the guarantee in common platforms
Most streaming platforms provide at-least-once delivery when producers retry and consumers commit after processing. In Kafka, this means producer acknowledgments from all in-sync replicas, retries enabled, and manual or carefully timed offset commits. Apache Pulsar uses individual or cumulative acknowledgments, while Amazon Kinesis consumers checkpoint their position after processing each batch.
Several configuration choices quietly change the effective guarantee, and they deserve review in every pipeline.
| Setting | Safe choice | Risk when misconfigured |
|---|---|---|
| Auto-commit of offsets | Disable or commit after processing | Records skipped after a crash |
| Producer acknowledgments | Wait for all replicas | Loss when a leader fails |
| Retry limit | High, with backoff | Silent drops after a few failures |
| Dead-letter queue | Route poison messages aside | Endless redelivery blocks the partition |
Retries can also reorder messages when several requests are in flight at once, so pipelines that depend on order should limit concurrent requests or rely on idempotent producers that preserve sequence.
Limitations and common mistakes
The guarantee covers delivery, not correct outcomes. A pipeline can deliver every event and still produce wrong aggregates if duplicates inflate counts or sums. Analysts often notice the problem only when totals disagree with a source system.
- Assuming duplicates are rare: during outages and rebalances, whole batches of thousands of records can repeat.
- Deduplicating on payload content: two legitimate identical events, such as two equal purchases, get merged wrongly.
- Short deduplication retention: a replay from hours earlier passes the check unnoticed.
- Ignoring external side effects: emails, webhooks and charges repeat even when the database write is idempotent.
- Committing before processing: the pipeline silently becomes at-most-once.
The simple explanation
Think of a courier who must get a signature for every parcel. If the courier is not sure the signature was recorded, the courier comes back with the same parcel. Nothing ever goes missing, but sometimes a parcel arrives twice.
At-least-once delivery works the same way for data. The system keeps resending until it is certain each message arrived. The receiving side simply has to recognize a parcel it already has and set the copy aside.
How it is used in practice
An online ticketing platform publishes an event for every completed booking to a topic with 12 partitions. A consumer service reads these events, writes each booking to the reporting database and sends a confirmation email. The service uses at-least-once delivery and commits offsets only after both steps succeed.
During a deployment, a consumer instance is stopped after processing about 800 events but before its next commit. The replacement instance rereads those 800 events. Because the database write is an upsert keyed by booking ID, the reporting table stays correct. The email step checks a table of sent booking IDs retained for seven days, so no customer receives a second confirmation.
The team accepts the occasional reprocessing cost in exchange for a pipeline that never loses a booking, which matters far more for revenue reports than a few seconds of extra work.