← Lessons

quiz vs the machine

Platinum1800

System Design

The Guaranteed Delivery

Persist messages so they survive crashes until delivered.

5 min read · advanced · beat Platinum to climb

What it is

Guaranteed delivery ensures a message is not lost even if the sender, broker, or receiver crashes. The messaging system writes the message to durable storage and keeps it until delivery is confirmed.

How it works

  • The broker persists the message to disk before acknowledging the sender.
  • It retains the message until the receiver acknowledges processing.
  • After a crash, the broker recovers unacknowledged messages and retries.

Why it matters

  • Protects against data loss for critical messages like orders or payments.
  • Lets producers and consumers run on different schedules safely.
  • Turns transient failures into retries instead of lost work.

The cost is performance and storage: writing to disk and waiting for acknowledgements adds latency. Guaranteed delivery usually gives at least once semantics, so a message may be delivered more than once after a recovery. Consumers therefore need to be idempotent so a redelivery does not cause double effects. Stronger exactly once guarantees require extra coordination.

Key idea

Guaranteed delivery persists messages durably and retries until acknowledged, usually giving at least once delivery that demands idempotent consumers.

Check yourself

Answer to earn rating on the learn ladder.

1. How does guaranteed delivery survive a broker crash?

2. Why must consumers be idempotent under guaranteed delivery?

3. What is the main cost of guaranteed delivery?