Delivery guarantees
A broker can re-deliver a message if there is no confirmation. Reliable processing therefore combines lasting effect with repeatable treatment.
- At-most-onceAcknowledgement before storing.
- At-least-onceConfirming after storage.
- Effectively onceAt-least-once plus idempotency.
Context
Why this is important
The confirmation time decides on loss or duplicate. Exactly-once does not exist as a transport commitment; effectively once arises from at-least-once plus idempotency. Outbox, Idempotence and Retry deepen individual mechanisms.
This building block declares delivery confirmations and re-delivery. Outbox ensures publication from a local transaction; Idempotency protects the effect from duplicates.
At a glance · Acknowledgement after saving
When is the message acknowledged?
The shop publishes an order for invoicing. A worker stores invoice and order identifier before confirming broker delivery.
This is how you read the picture
- At-most-once A crash before saving loses the order.
- At-least-once A crash after saving causes redelivery.
- Effectively once With ID checking enabled, the result is “effectively once” instead of two invoices.
- Broker delivers B-1042
- Worker saves invoice
- Crash
- Worker acknowledgesNot applicable
- Broker redelivers
- Worker saves invoice (re-)
- Worker acknowledges
two invoices
Redelivery of B-1042 reaches a worker without an ID check; it creates a second invoice.
Benefits & limitations
Helps if:
- Delivery guarantees guide design when transport failures can lose or redeliver messages.
- Separate transport acknowledgement and business changes require handling of the window in which redelivery can occur.
- An exactly-once guarantee must explicitly state the transaction scope it supports.
Boundaries
- At-most-once can lose requests; at-least-once can create duplicates. Choose based on the business consequences for invoicing.
- The broker and invoice store have separate transaction boundaries; a shared identifier is needed to recognise redelivery.
- Idempotency protects the effect within the worker; Retry also bounds retries and resource consumption.
In practice
- Choose the transport guarantees for loss and redelivery and state their transaction boundary. Verify business success separately.
- Durably store the recipient’s business effect, then acknowledge the message. A crash between commit and acknowledgement causes redelivery, which the recipient must reliably associate with the existing operation.
- Test duplicates and permanent failures, including identifiers and ordering. Idempotency protects effects; Retry controls attempts.
Read the detailed explanation
Delivery guarantees define the outcomes a transport permits: at-most-once avoids repeated delivery but can lose messages; at-least-once retries until acknowledgement and can deliver duplicates.
Exactly-once claims apply only within explicitly supported transaction boundaries. A transport acknowledgement does not automatically mean the business effect is durable. Deduplication, resumption and handling permanent failures close this gap.
Idempotency protects the recipient’s business effect against duplicate delivery; Retry controls the timing and limits of further attempts. Transport acknowledgement and business success remain separate claims.
Exactly-once is not a network transport guarantee. In practice, “effectively once” combines at-least-once delivery with idempotent processing; see Idempotency.
Check your understanding
Test yourself in three stages
ReadingCheck in the picture
What result does the “Confirm before saving” view show with a crash between steps?
View the solution with justification
“No bill – lost order”: B-1042 is receipted, but the invoice was never stored.
ApplyingTransferred to a new situation
The shop confirms after saving, the worker crashes in between and does not check an identifier. How many bills are created for B-1042?
View the solution with justification
Two. The broker delivers again, and without identification check, the worker creates the invoice a second time.
EvaluateWeighing an alternative
What speaks for at-least-once with Idempotence instead of at-most-once? What is the price, and what do you recommend for bills?
View the solution with justification
Advantage: No order is lost. Disadvantage: The worker needs identification check and filing. For invoices, I recommend at-least-once with Idempotence, because a lost order weighs more technically.
Explore further
These building blocks continue the thoughts of this page.
References
- RabbitMQ – Consumer Acknowledgements and Publisher Confirms (opens in new tab)Differentiates confirmation from producers and consumers as well as re-delivery.
- Apache Kafka – Message Delivery Semantics (opens in new tab)Describes at-most-once, at-least-once and transactional exact-once semantics.
- Amazon SQS – At-least-once delivery (opens in new tab)Shows why standard queues require idempotent processing.