Queue
Queues buffer independent work between producer and consumer.
- BufferHolds work until processing capacity is available.
- AcknowledgementFollows the durable business effect.
- 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.
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
- Buffer Finite capacity
- Acknowledgement Plan redelivery before ack
- Backlog Oldest message as SLO
| Comparison | State | Evidence | Limit |
|---|---|---|---|
| Waiting | Job durably buffered | Age and count | Capacity or expiry |
| Reserved | One consumer holds the lock | Lock duration | Redelivery |
| Failure channel | Attempts exhausted | Failure reason and correlation | Repair and replay |
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
- Submit an invoice job while all workers are busy. Measure how backlog and oldest-message age grow relative to the arrival rate.
- Redeliver a message before acknowledgement. Verify business idempotency and the defined path for permanently failing jobs.
- 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
ReadingCheck in the picture
When is a message acknowledged?
View the solution with justification
After the business effect is stored durably.
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.
EvaluateWeighing an alternative
When is buffering insufficient?
View the solution with justification
When sustained arrival exceeds throughput and reaches the finite bound.
Explore further
These building blocks continue the thoughts of this page.