# Message queue

> A message queue is a component that holds tasks or events in order until a worker is ready to process them, so systems can hand off work without waiting, absorb spikes in volume and retry failures safely.

Also called: queue, job queue, task queue, message broker, background jobs. Category: Agents and automation. Source: https://aibuildindex.com/glossary/message-queue

## In the index

- Redis: median $3,550, middle half $940 to $12,800, 108 priced briefs (https://aibuildindex.com/skills/redis)
- Microservices: median $6,700, middle half $2,100 to $10,970, 34 priced briefs (https://aibuildindex.com/skills/microservices)

A message queue sits between the part of a system that creates work and the part that does it. Instead of processing a request on the spot, the system writes a message to the queue and moves on; workers pick messages up when they have capacity. This matters a great deal for AI builds, because model calls are slow, rate-limited and occasionally fail. A queue keeps a sudden burst of uploads or messages from overwhelming the model provider or timing out the user.

## How it works

A producer adds messages to the queue. Each message describes one job, such as "transcribe this call" or "summarise this document". One or more workers take messages from the front, process them and acknowledge success. If a worker crashes or the job fails, the message becomes visible again and is retried; after a set number of failures it moves to a dead-letter queue for inspection. Common choices include Redis-based job libraries, RabbitMQ, Amazon SQS and Kafka, which is more of an event log than a simple queue.

An example: a recruiting tool lets a buyer upload five hundred CVs at once. Each upload becomes a message. A small pool of workers scores CVs with a language model at a pace that stays under the provider's [rate limit](https://aibuildindex.com/glossary/rate-limit), and the screen shows progress as messages are completed. Without the queue, the upload would hang, hit limits and lose files.

## What it means for cost

Adding a queue means more infrastructure to host and monitor, and more design work: what goes in each message, how many workers run, how failures are retried and how duplicates are avoided through [idempotency](https://aibuildindex.com/glossary/idempotency). For a low-volume automation that handles one item at a time, this can be over-engineering.

It becomes worth paying for when volume is spiky, jobs take longer than a web request should, or the system must not lose work. Ask a builder how the design behaves under a sudden spike, where failed jobs go, and how someone can see what is waiting. The answers say a lot about [scalability](https://aibuildindex.com/glossary/scalability) and [error handling](https://aibuildindex.com/glossary/error-handling).

## Common questions

### Do no-code tools like n8n or Zapier use queues?

They do internally to run workflows, and n8n can be configured in a queue mode with separate workers when self-hosted. For most small automations that built-in behaviour is enough. A dedicated queue is usually added when a custom application needs control over concurrency and retries.

### What is the difference between a message queue and a database table of jobs?

A simple jobs table can work as a queue at low volume and is easy to inspect. Dedicated queues handle concurrency, locking, visibility timeouts and retries out of the box, which matters when many workers process jobs at once.

## Related terms

- [Event-driven architecture](https://aibuildindex.com/glossary/event-driven-architecture): Event-driven architecture is a way of designing software in which components react to events, such as a new order or a signed contract, as they happen, rather than checking for changes on a timetable or calling each other directly.
- [Error handling and retries](https://aibuildindex.com/glossary/error-handling): Error handling and retries are the parts of an automation or AI system that detect failed steps, try them again where that is safe, and report or park the work that still fails, so problems are noticed rather than silently lost.
- [Idempotency](https://aibuildindex.com/glossary/idempotency): Idempotency is the property of an operation that produces the same result whether it runs once or several times, so a retried or duplicated request does not create a second invoice, email or record.
- [Rate limit](https://aibuildindex.com/glossary/rate-limit): A rate limit is a cap set by a service on how many requests, or how much data, an application can send in a given period, which AI and software providers use to share capacity and protect their systems.
- [Batch processing](https://aibuildindex.com/glossary/batch-processing): Batch processing is running a large set of AI requests together as a background job rather than one at a time in real time, which suits work that can wait and is often cheaper through providers' batch services.
- [Scalability](https://aibuildindex.com/glossary/scalability): Scalability is a system's ability to handle more users, requests or data without failing, slowing badly or becoming disproportionately expensive, usually by adding resources rather than rebuilding.
