Search DistillSys

Find a concept

Type at least two characters to search lessons, designs, papers, and interview prep.

Messagingintermediate6 min read

Delivery Semantics

Understand what at-most-once, at-least-once, and effectively-once processing really promise.

2–5 minute refresher
Mental model

Delivery promise + processing boundary + side-effect semantics

30second
refresher
Delivery semantics describe how message transfer and acknowledgement behave under failure. End-to-end outcomes also depend on consumer state, offset commits, retries, and every side effect beyond the broker.

What problem does it solve?

A consumer can crash before or after processing but before acknowledging. The broker must choose between possible loss and possible duplicate delivery.

How it works

  1. Assign a stable identity to each logical event.
  2. Fetch from a durable position or subscription.
  3. Apply the state transition idempotently or transactionally.
  4. Commit progress only after the durable outcome.
  5. Send external effects through their own deduplicated or outbox-driven path.
Decision guide

Key trade-offs

ChoiceWhat you gainWhat it costs
At-most-onceNo broker redeliveryPossible loss
At-least-onceRetry until acknowledgedDuplicate processing
Transactional processingAtomic state and progressScoped systems and coordination
What happens if?

The consumer writes state, then crashes before committing its offset

The message is delivered again. A stable event ID and atomic outcome record let the consumer recognize the duplicate and return success without applying the change twice.

Where it appears

  • Kafka transactions
  • SQS visibility timeout
  • Pub/Sub acknowledgements
  • Transactional outbox
Senior interview modeWhat does exactly-once mean in a real event pipeline?Show answer
Only within a clearly defined atomic boundary. The broker may atomically connect input offsets and output records, but databases, emails, payments, and other external effects still need idempotency or reconciliation.
#delivery#duplicates#idempotency#messaging