← Module 07 · System Architecture
MODULE 07 · SYSTEM ARCHITECTURE

Message Queue

A message queue temporarily holds messages between producers and consumers for decoupled asynchronous processing.

01

What is it?

A message queue is a holding place for work or information that one part of a system wants another part to handle.

The sender, called the producer, can put a message into the queue and move on. The receiver, called the consumer, can take that message when it has capacity and process it.

Simple definition:
A message queue lets one part of a system hand work to another part without needing both parts to be ready at the exact same moment.

02

Think of it like...

Think of a restaurant order rail. The waiter places an order ticket on the rail. The kitchen takes the next ticket when it is ready, instead of making the waiter stand beside the chef until the meal is finished.

Producer
places work
Message Queue
holds work
Consumer
processes work

The useful separation: the producer does not need to know exactly when the consumer will be free. The queue absorbs the timing difference.

03

What does it do?

A queue turns a direct handoff into a managed flow. That gives a product team several useful capabilities, with trade-offs to plan for.

Decouples services

The producer and consumer can change, scale, or restart independently.

Absorbs traffic spikes

Messages can wait in the queue while consumers work through a sudden burst.

Enables async work

A user-facing request can finish while slower work continues elsewhere.

Supports retries

Failed work can be attempted again instead of disappearing on the first error.

Creates a backlog

Waiting messages make demand visible, but an unprocessed backlog can become a product problem.

Adds operating cost

Teams must decide how to monitor delivery, duplicates, ordering, and failures.

PM perspective: “Asynchronous” does not mean “instant.” It means the user or producer does not have to wait for the downstream work to finish.

04

Where is it used?

Message queues are a good fit when work can happen after the immediate interaction or when two system parts should not be tightly coupled.

Notifications

Queue email, SMS, or push notification work after an account or order changes.

Media processing

Queue image resizing, video transcoding, or document extraction without blocking upload completion.

Commerce workflows

Pass order work to inventory, payment, fulfillment, and customer communication services.

Data synchronization

Move updates between systems when the destination may be slower or temporarily unavailable.

Reports and exports

Start a long-running report and let the user return when the result is ready.

Batch operations

Process many records with a controlled number of workers instead of one huge request.

05

Example

Real business scenario: an online order

A customer places an order. The checkout service should confirm the order quickly, but sending the receipt, updating inventory, and notifying the warehouse may take different amounts of time.

Checkout Service
producer
Order Queue
OrderPlaced
Inventory / Email / Fulfillment
consumers

Immediate user experience

The customer sees “Order received” without waiting for every downstream system.

Consumer responsibility

Each consumer processes the message for its own job and reports failures for retry or review.

Product benefit

A slow warehouse integration does not necessarily make checkout slow for everyone.

Product risk

If the queue is delayed, inventory or email may be stale even though checkout succeeded.

06

How it connects

The queue sits between a producer and one or more consumers. The surrounding architecture determines whether the system is reliable and understandable.

Request
user intent
Producer
creates message
Queue
stores until read
Queue
message waits
Consumer / Worker
takes message
Outcome
side effect or status

Important design question: what should happen if the consumer fails after receiving a message? The answer may involve retries, idempotency, visibility timeouts, a dead-letter queue, and monitoring.

07

Do Not Confuse

These concepts can appear together, but they solve different problems.

Message Queue vs Event

An event describes something that happened. A queue is a delivery mechanism that holds work or messages until a consumer handles them.

Message Queue vs Event Bus

A queue commonly gives one work item to one consumer. An event bus or pub/sub pattern can let multiple subscribers receive the same event.

Message Queue vs Background Job

A background job is the work being done later. A queue is one way to store and distribute that work.

Message Queue vs Cache

A cache keeps data for faster reads. A queue holds messages waiting for processing. A cache is not a reliable work ledger.

Async vs faster

Async processing can improve responsiveness, but total completion may still take seconds or minutes.

Retry vs duplicate-free

Retries improve resilience, but they can deliver the same message more than once. Consumers often need idempotent handling.

09

What to Remember

A message queue separates the moment work is requested from the moment work is processed.

It helps systems absorb spikes, isolate services, and run slow work asynchronously.

For product decisions, ask about freshness, retries, duplicates, ordering, backlog limits, and what the user should see while work is pending.

PM Perspective: A queue can make a product feel responsive, but the product still needs a truthful status model so users know whether their work is queued, processing, completed, or failed.

Producer
Queue
Consumer
↑