Considerations of a Distributed Messaging Queue’s Design

Lesson 66 of 25610 min readPremium lesson preview
In this lesson2 sections

Considerations of a Distributed Messaging Queue’s Design

Message order needs a scope and a definition. Before selecting an algorithm, decide whether the application needs one producer’s sequence, a broker partition’s accepted order, causal dependencies, or an approximate event-time view.

The design must then preserve that contract through concurrent producers, delayed messages, consumer failures, and retries. Each choice affects buffering and processing capacity.

Ordering of messages

A chat conversation may need an agreed order within that conversation, while unrelated conversations can proceed independently. An email workflow may tolerate reordering for some messages but still require a verification step before a dependent notification. Define the business dependency; the application category alone does not settle ordering.

We categorize message ordering into two types:

  • Best-effort ordering

  • Strict ordering

Best-effort ordering

A best-effort contract tries to preserve a useful order without guaranteeing it in every case. In the simplified example below, the broker accepts arrival order and does not reconstruct the producer’s send order.

The rest of this lesson is for Premium members

Premium opens every lesson in this course, along with all questions and solutions on PracHub.