What is Message Queue?

A message queue is a place where messages can wait until a receiving application is ready to handle them. A producer sends a message to the queue, and a consumer retrieves or receives it and performs the work. The producer and consumer can operate at different times and, depending on the system, at different rates.
Imagine a website accepting a photo upload. Instead of making the visitor wait while every thumbnail is created, the website records a task and a worker processes it in the background. The queue helps bridge the gap between accepting the work and completing it. It does not, by itself, prove that the thumbnail was created or that the result was saved.
How a message queue works
A message is a unit of information, such as an order reference, an event or a request to perform a task. It usually contains a payload and may have metadata such as an identifier, creation time, routing information or retry count. The queueing product and application determine its format and limits.
A producer prepares a message and sends it to a queueing service or broker.
The service accepts it according to its configuration and reports the relevant result to the producer.
The message waits until an eligible consumer receives or retrieves it.
The consumer performs the required work and records the outcome.
The consumer acknowledges or deletes the message according to the product's delivery model. If handling fails, a retry or other policy may apply.
The precise order of storage, acknowledgement, delivery and removal differs between systems. Some messages can expire, be rejected or be moved elsewhere. The illustration shows the basic flow, not a promise that every queue stores every message indefinitely.

Component | Responsibility | Example |
|---|---|---|
Producer | Creates and sends a message. | A website records that an image needs processing. |
Queue | Holds or makes pending messages available under its rules. | A named work queue for image jobs. |
Consumer | Receives a message and performs work. | A worker creates the required image sizes. |
Acknowledgement or deletion | Signals that a delivery can be removed under the chosen model. | A worker confirms handling after recording the result. |
Monitoring | Shows whether work is progressing and where it is delayed. | Alerts on message age, failures and backlog. |
The queue system guide covers the broader idea of managing waiting work. A message queue applies that idea to communications between software components. It may be implemented by a managed cloud service, a broker on a server, or another software system; the word queue does not identify one product.
Why put a queue between applications?
A queue can reduce the need for the producer to wait for the consumer to finish. It can absorb a temporary burst, allow work to resume when a worker returns, and distribute eligible tasks across workers. Those benefits depend on successful acceptance, storage, retention, capacity and recovery configuration.
The queue is still a dependency. If it is unreachable or full, the producer needs a defined response. If the consumer remains slower than incoming work, the backlog keeps growing. If the message expires before processing or the downstream service cannot accept the result, merely adding a queue does not solve the problem.
Microsoft's queue-based load levelling guidance explains how a queue can smooth bursts while workers protect a downstream resource. Worker concurrency must still respect the database or API's capacity. A queue moves the point at which work waits; it does not create unlimited processing capacity.
Queue, broker and event log: different responsibilities
A queue is a destination and delivery model for pending work. A message broker is intermediary software that can accept, route and deliver messages and may manage multiple queues. Depending on the product, it can provide exchanges, topics, subscriptions, persistence and other capabilities. A managed queue service may hide much of that infrastructure from the user.
Concept | Main question | Important distinction |
|---|---|---|
Work queue | Which worker should handle this task? | Consumers commonly compete for deliveries; retries can still cause repeated delivery. |
Publish/subscribe | Which interested subscribers should receive this event? | Each subscription may need its own delivery state. |
Retained event log | How can consumers read and, where supported, replay retained events? | Retention and consumer position differ from deleting a completed work item. |
Broker | How are messages accepted, routed and delivered? | A broker can implement several patterns; it is not synonymous with one queue. |
These are design patterns, not mutually exclusive product categories. Apache Kafka, for example, uses a retained partitioned log and consumer groups: members of a group share partition processing, while separate groups can independently consume the same topic. Its ordering guarantee is scoped to a partition, not a global order across all partitions. Choose a pattern based on the required delivery, retention and replay behaviour.
What does an acknowledgement actually mean?
There are at least two separate boundaries. A producer confirmation can report that the queueing system accepted a publication under its rules. A consumer acknowledgement or deletion tells the system how to treat a particular delivery. Neither automatically proves that an unrelated payment, database update or physical action completed correctly.
RabbitMQ's publisher confirms and consumer acknowledgements documentation describes these as separate mechanisms. In a manual acknowledgement model, a consumer can acknowledge after its work reaches the application's chosen safe point. Automatic acknowledgement can reduce overhead but may treat a delivery as handled before the useful work finishes. The appropriate choice depends on the consequences of loss and duplication.
Durability also has multiple parts: the queue's durability, the message's persistence, replication, the acknowledgement received by the producer and the storage policy all matter. A durable queue name does not automatically make every message or downstream side effect durable. Check the product's actual guarantees and test the failure scenarios that matter.
The failure between doing work and acknowledging it
Consider a worker that reads a request to send a notification. It successfully sends the notification, but crashes before acknowledging the message. The queueing system may later deliver the message again because it has no confirmation that the first attempt finished. A second worker can then send the notification twice.
Reversing the order is not a complete fix. If the worker acknowledges before sending and crashes afterwards, the message may be removed even though the notification was never sent. The application needs a recovery design that covers the gap between queue state and the external side effect.
A stable business identifier can help the consumer recognise a repeated request. The idempotency guide explains how to make repeated handling produce the intended effect. Where possible, atomically record the operation and its idempotency key in the same transactional system. If the action occurs in a separate external service, use that service's supported idempotency mechanism and reconcile uncertain outcomes. A queue's delivery tag alone is not necessarily a permanent business identifier.
Visibility timeouts, acknowledgements and retries
In Amazon SQS, a received message normally becomes temporarily invisible to other consumers while it is being processed. The consumer deletes it after successful processing. If it is not deleted before the visibility timeout expires, it can become available again. The SQS visibility timeout documentation also notes that its at-least-once model does not absolutely rule out duplicate delivery during that period.
RabbitMQ's manual acknowledgement model works differently: an unacknowledged delivery can be requeued when the relevant channel or connection closes, subject to configuration. Do not assume a single visibility timer applies to every queueing product. In SQS, a worker can adjust visibility when appropriate; an excessively short timeout can lead to concurrent duplicate work, while an excessively long timeout can delay recovery after a worker dies.
Retry policies should distinguish a temporary failure from a message that will never succeed without intervention. The retry logic guide covers backoff and repeated attempts. Avoid an immediate, unlimited retry loop that consumes capacity and repeatedly calls a struggling dependency.
Failure | Typical response to consider | What to verify |
|---|---|---|
Brief downstream timeout | Retry with bounded backoff and jitter. | Whether the first request may already have succeeded. |
Worker crash before acknowledgement | Redeliver under the product's rules. | Duplicate handling and unfinished work. |
Invalid message or incompatible schema | Isolate for review or a dead-letter queue. | Alerting, retention and a safe correction process. |
Queue or storage unavailable | Reject, buffer or retry at the producer according to policy. | Whether acceptance was confirmed and how long local buffering lasts. |
Persistent downstream overload | Limit intake or processing and restore capacity. | Backlog age, expiry risk and the actual bottleneck. |
A dead-letter queue is a place to isolate messages that meet a failure policy, not a bin that resolves them automatically. Assign ownership, alerts, retention and a safe replay procedure. Moving a failed message aside can change ordering, so check whether later work is allowed to proceed.
Is a message queue always first in, first out?
Do not assume that a queue guarantees the order in which work completes. A system may offer a FIFO option, but the scope and conditions matter. Multiple consumers, retries, priorities, partitions and differing processing times can all affect the observed order. Even if messages are delivered in order, a slower first task can finish after a faster second task.
Amazon SQS standard queues provide at-least-once delivery and best-effort ordering; duplicates and occasional reordering are possible. SQS FIFO queues have different ordering and deduplication features, including message groups. These are product-specific guarantees, not a general promise that all business effects happen exactly once. If order matters, identify the entity whose operations must remain ordered and design the consumer and recovery path accordingly.
Worked example: a burst and the backlog it leaves
Suppose a UK business receives 1,200 image jobs over 10 minutes. Assume arrivals are evenly spread for this calculation and four workers each complete 20 jobs per minute. All workers stay available, each job has the same cost, and there is no retry, expiry or downstream limit. This is an illustrative model, not a benchmark.
Quantity | Calculation | Result |
|---|---|---|
Arrival rate | 1,200 ÷ 10 minutes | 120 jobs per minute |
Worker capacity | 4 × 20 jobs per minute | 80 jobs per minute |
Backlog growth during the burst | 120 − 80 | 40 jobs per minute |
Backlog after 10 minutes | 40 × 10 | 400 jobs |
During the burst, the queue grows even though all four workers are busy. If new arrivals then fall to 50 jobs per minute and the workers maintain 80 completed jobs per minute, only 30 jobs per minute are available to reduce the backlog. Draining 400 jobs takes about 13 minutes 20 seconds. At 80 arrivals per minute, the backlog would remain roughly constant; above 80, it would continue to grow.
These numbers are jobs, not bytes or broadband speed. Real jobs differ in duration, workers can fail, retries consume capacity and downstream services may impose their own limits. An average rate can hide a short spike or an old message trapped behind repeated failures. A queue smooths a burst only when enough spare capacity exists later to clear it before retention or business deadlines expire.
Queue depth is not the whole story
A queue can look small while an important message has been waiting too long, or large while a planned batch is being processed normally. Track the age of the oldest relevant message, arrival and completion rates, work in flight, processing time, retries and dead-letter activity as well as the number waiting.
Metrics are product-specific. Some queue counts are approximate; some include or exclude in-flight work; an oldest-message metric may change when failed messages are moved or reordered. Understand the definition before building an alert. Add an end-to-end measure such as time from accepted job to confirmed outcome when that is what users care about.
Local and cloud queues on a broadband connection
A queue on a local server can allow local producers and workers to continue during a WAN outage if power, LAN, queue storage and dependent services remain available. A cloud queue depends on the broadband path for local producers and workers. A cloud service can remain healthy while the local site cannot reach it.
A remote queue cannot store a message it never received. If an application must accept jobs during an outage, it needs an explicitly designed local buffer, acknowledgement boundary, capacity limit and reconciliation process. A local queue does not automatically deliver messages to a cloud service after reconnection unless a bridge or application is configured to do so.
For a UK home lab or small office, trace the full path: device, WiFi or Ethernet, router, broadband, DNS, authentication, queue service, workers and the downstream system. Faster headline download speed does not repair expired credentials or a saturated worker. Measure the point where messages are delayed before changing the broadband package.
How to investigate a growing message backlog
Use an authorised test and protect message payloads and logs. The steps below describe a diagnostic method, not a test performed against your system.
Confirm the business symptom and define the relevant acceptance-to-completion deadline. Record the oldest message age as well as queue depth.
Compare arrival and successful completion rates over the same interval. Include in-flight work and retries according to the product's metric definitions.
Check worker availability, concurrency, processing time, error rates and acknowledgement or deletion behaviour. A running process is not proof of useful progress.
Inspect downstream databases, APIs, storage and rate limits. More workers can make the problem worse if the next service is already saturated.
Review visibility or acknowledgement settings, message expiry, dead-letter queues and recent configuration changes. Check for duplicates and repeated poison messages.
Test a controlled recovery and confirm that the backlog drains without duplicate side effects. Record the result at the application boundary, not only at the queue.
Useful safeguards include:
Authenticate producers and consumers and grant only the permissions each requires.
Encrypt traffic and protect stored messages according to their sensitivity.
Bound message size, retries, retention and queue growth; decide what happens when a limit is reached.
Alert on sustained backlog age, failed deliveries and dead-letter activity, with a named response owner.
Test recovery, replay and idempotency with representative failures before relying on them.
Message queue questions answered
What is the main purpose of a message queue?
It lets a producer and consumer exchange work asynchronously, so a message can wait until an eligible consumer handles it. The actual reliability depends on the product and configuration.
Is a message queue the same as a message broker?
No. A queue is a destination or delivery mechanism for waiting messages. A broker is intermediary software that can manage and route messages, potentially across several queues and other patterns.
Does a queue guarantee that a task is completed?
No. Acceptance, delivery, acknowledgement and the completed business outcome are separate events. The application must record and verify the outcome it needs.
Can a message be delivered more than once?
Yes. In at-least-once systems, retries and failures can produce duplicate deliveries. Consumers should safely handle repeats where the application requires it.
Are messages always processed in the order sent?
No. Ordering depends on the system, queue type, scope and consumer design. Multiple workers and retries can change completion order even when delivery order is constrained.
What happens if a worker crashes?
The outcome depends on the acknowledgement or visibility model and configuration. An unacknowledged or undeleted message may be delivered again, so the worker's side effects need safe recovery.
Does a cloud queue work when broadband is down?
The cloud service may still operate, but a local producer or consumer cannot use it without a working path. Messages not yet accepted need an explicitly designed local buffer if they must be retained.
The practical takeaway
A message queue gives work a place to wait and separates the producer's timing from the consumer's. To make it reliable, define the acceptance boundary, what acknowledgement means, how duplicates and failures are handled, and how the backlog will be drained. The queue is one part of the complete outcome.
The broadband terminology guide connects this topic with networking, data transfer and reliability.

