Standalone conceptMechanismChapter II · Communication · Building block 9 of 23

Queue

Queues buffer independent work between producer and consumer.

  1. BufferHolds work until processing capacity is available.
  2. AcknowledgementFollows the durable business effect.
  3. BacklogBecomes visible through age, rate, and duration.

Context

Why this is important

The buffer buys time but needs a finite bound and observable progress.

The asynchronous invoice work is hypothetical; currently seven modules run together.

Shop example · Mapping

Queue states

The shop remains a modular monolith with seven modules. Hypothetically, Order places an invoice-generation job on the existing broker queue after commit. A worker creates and stores the invoice, then acknowledges. The team stops the worker before acknowledgement, fills the queue faster than it is processed, and tests idempotency, oldest-message age, capacity limit, and dead-letter path. Only this evidence supports the asynchronous extension.

This is how you read the picture

  1. Buffer Finite capacity
  2. Acknowledgement Plan redelivery before ack
  3. Backlog Oldest message as SLO
Queue states
ComparisonStateEvidenceLimit
WaitingJob durably bufferedAge and countCapacity or expiry
ReservedOne consumer holds the lockLock durationRedelivery
Failure channelAttempts exhaustedFailure reason and correlationRepair and replay
Every state needs a measurable transition.

Benefits & limitations

Helps if:

  • Work can complete independently after the request.
  • Short-term load spikes should be leveled.
  • Redelivery can be handled idempotently.

Boundaries

  • A full buffer only shifts overload; producers need visible rejection or throttling.
  • Asynchrony increases business delay and requires queryable status.
  • Poison messages must not block normal work indefinitely.

In practice

  1. Submit an invoice job while all workers are busy. Measure how backlog and oldest-message age grow relative to the arrival rate.
  2. Redeliver a message before acknowledgement. Verify business idempotency and the defined path for permanently failing jobs.
  3. Set retention, dead-letter rules, and alert thresholds. Assess whether the queue truly buffers the burst without creating an unnoticed delay.
Read the detailed explanation

The producer writes an independent job and receives broker acknowledgement. A consumer reserves it, stores the business effect, and then acknowledges; without acknowledgement the job becomes visible again according to the contract.

Queue age, arrival rate, and processing time reveal backlog earlier than count alone. Capacity limits, expiry, and dead-letter rules prevent unbounded growth and isolate persistently faulty messages.

Delivery Guarantees cover acknowledgement and redelivery. Backpressure limits producers when buffer and consumers cannot carry the load.

Check your understanding

Test yourself in three stages

  1. ReadingCheck in the picture

    When is a message acknowledged?

    View the solution with justification

    After the business effect is stored durably.

  2. ApplyingTransferred to a new situation

    What does the shop measure under overload?

    View the solution with justification

    Oldest age, arrival rate, processing time, and depth.

  3. EvaluateWeighing an alternative

    When is buffering insufficient?

    View the solution with justification

    When sustained arrival exceeds throughput and reaches the finite bound.