AlgoMaster Logo

Delivery Semantics

High Priority8 min readUpdated July 4, 2026
AI Mock Interview

Practice this topic in a realistic system design interview

When a system sends a message, several things can go wrong.

The producer may retry because it did not hear back. The broker may send the same message again because a consumer crashed. The consumer may finish the work but crash before telling the broker it is done.

Delivery semantics are the rules for what a messaging system does when delivery fails, succeeds, or is uncertain.

These rules matter because they shape the consumer code. If a message can arrive twice, the consumer must handle duplicates. If a message can be lost, the business must be okay with that loss.

The most important practical lesson is this:

Delivery semantics describe message delivery. Your application still owns the business result.

This chapter covers at-most-once, at-least-once, and exactly-once delivery in practical terms.

1. Delivery vs Processing

Before comparing the delivery types, separate two ideas:

ConceptMeaning
DeliveryThe broker gives a message to a consumer.
ProcessingThe consumer performs the business action.
AcknowledgmentThe consumer tells the broker, "I am done with this message."
CommitThe system records progress, such as deleting the message or saving the consumer's position.

A broker can know whether a message was acknowledged. It usually cannot know whether the business action was completed correctly.

For example, a payment worker might charge a card and then crash before acknowledging the message. The broker sees no acknowledgment, so it sends the message again. The second attempt may charge the card again unless the consumer is designed to prevent that.

That is why delivery rules and duplicate-safe consumer code go together.

2. The Three Semantics

The usual three delivery types are:

SemanticBroker BehaviorMain RiskConsumer Requirement
At-most-onceTry once, then move onMessage lossApplication must tolerate loss
At-least-onceRetry until success or a limitDuplicate deliveryConsumer must handle duplicates safely
Exactly-onceAvoid duplicate effects within a clear boundaryMore moving partsTransactions or duplicate checks

These rules do not work automatically. They depend on broker settings, safe storage, retries, acknowledgments, and how the consumer writes its results.

3. At-Most-Once Delivery

Premium Content

This content is for premium members only.