Skip to content
IT glossary
BackendUpdated December 3, 2026

Message delivery guarantees

Гарантии доставки сообщений

These guarantees describe whether a message can be lost or received more than once when something fails. They may cover a single delivery step or the result of processing the message.

Also known as: at-least-once, exactly-once, at-most-once

Start with the missing acknowledgment

A worker takes a shipment request from a queue, creates a record, and crashes before acknowledging the message. The broker cannot tell whether the worker finished or never started. It can redeliver the request, which risks a duplicate, or drop it, which risks losing work. A delivery guarantee tells you what the system promises in cases like this, and where that promise stops.

The three guarantees

  • At-most-once: zero or one delivery. No redelivery within the stated scope, but a message may be lost. A consumer that acknowledges before doing the work can lose that work if it crashes in between. This can be acceptable for readings that will soon be replaced by newer ones.
  • At-least-once: one or more deliveries. Within the system's stated failure and retention limits, the message will be delivered, but it may be redelivered if an acknowledgment is missing. This is common for order events, where consumers can be designed to handle repeats safely.
  • Exactly-once: one result within a defined boundary. In stream processing, for example, each input can contribute one committed result even if the code runs again after a failure. Check what the system actually guarantees: a single delivery, a committed output, or a business effect.

Example: make a retry safe

Suppose ShipmentRequested carries a stable event_id. In one database transaction, the worker tries to insert that ID into a processed-events table with a unique constraint. It creates the shipment record only if the insert succeeds. It acknowledges the message after the transaction commits. A crash before commit leaves neither change behind, so a retry can do the work. A crash after commit but before acknowledgment can cause redelivery, but the stored ID prevents a second shipment record.

This gives the database change an idempotent outcome; it does not prevent the broker from redelivering. The same transaction also cannot undo a call to a carrier's API. To retry such a call safely, the carrier needs to recognize a stable idempotency key for the operation, or the integration needs a way to resolve uncertain outcomes before repeating it.

Check the boundaries

A publisher confirmation tells the sender what the broker accepted under its configured rules, not that a worker completed the job. A producer retry can also create duplicates if the original publish succeeded but its confirmation was lost. On the consumer side, a retry limit or a dead-letter queue can stop automatic redelivery without completing the work. None of the three guarantees specifies message ordering.

How it comes up in interviews

If asked whether Kafka offers exactly-once processing, distinguish a Kafka-to-Kafka pipeline from one that writes elsewhere. Kafka transactions can commit produced records and consumed offsets together, and downstream consumers can read only committed records. That transaction does not automatically cover an external database write. A strong answer identifies the boundary, then walks through what happens if the process crashes immediately before or after committing the result.