Picture the "Place order" button. When you click it, the system has to charge the card, issue the invoice, send the email, notify inventory and update the dashboard. If the API does all of that before answering, the person sits there watching the spinner. If the email service is down, the whole purchase fails because of an email.
A queue fixes this. The API records the order, puts the rest of the work in a queue and answers right away. Other processes, the consumers (or workers), pick up the tasks and handle each one in their own time. If one of them crashes, the task is still there, waiting.
This article explains how queues work, compares the most used tools (RabbitMQ, Kafka, SQS, BullMQ and Redis) plus the second-tier ones worth knowing, and shows the mistakes that come up most. I checked the facts against each tool's official documentation on November 21, 2026.

Why Use a Queue
The restaurant ticket is the best analogy I know. The waiter writes down the order, hangs it on the rail and goes back to the dining room. The kitchen pulls the tickets in order, as fast as it can. If a tour bus shows up, the rail fills up, but nobody gets sent away.
In software, a queue brings four gains:
- Fast response: the API only saves and publishes. The slow work happens later.
- Decoupling: the publisher doesn't need to know who consumes, or whether they're up right now.
- Absorbing spikes: on Black Friday, the queue grows and the consumers drain it. Without a queue, the spike takes down the target service.
- Retrying: if processing fails, the message goes back to the queue and gets tried again.
The cost is real: one more piece to run, eventual consistency (the dashboard updates seconds later, not instantly) and a new kind of bug, the duplicate message. For a small API with fast operations, a queue can be overkill. The API concepts article helps decide what needs to be synchronous.
The Vocabulary in One Table
| Term | What it is |
|---|---|
| Producer | Whoever publishes the message |
| Consumer (worker) | Whoever reads and processes it |
| Broker | The server that stores and delivers the messages |
| Ack | The consumer's confirmation: "processed it, you can delete it" |
| Redelivery | The message goes back to the queue because no ack came |
| DLQ (dead-letter queue) | The queue that receives messages that failed too many times |
| Fan-out | One message copied to several different consumers |
| Offset | In a log, the position up to which the consumer has read |
A Queue That Deletes or a Log That Keeps
This is the difference that confuses people most, and the one that weighs most in the choice.
Classic queue (RabbitMQ, SQS, BullMQ, the Redis list): the message is delivered to one consumer and, after the ack, deleted. It's the right model for tasks: "issue this invoice", "send this email". Each task should be done once, by someone.
Log (Kafka, Redis Streams, RabbitMQ streams): messages stay stored in sequence for a while (in Kafka, 7 days by default), and each consumer keeps its own offset, the position where it stopped. Reading doesn't delete. It's the right model for events: "order 42 was paid". Several systems can read the same event, and you can go back in time and reprocess.
One question settles most cases: will anyone need to read this message again later? If the answer is yes (auditing, a new system that needs the history, reprocessing after a bug), you want a log.
Delivery Guarantees
The Kafka documentation defines the three guarantees with a clarity that's hard to beat:
| Guarantee | Official definition | In practice |
|---|---|---|
| At most once | "Messages may be lost but are never redelivered" | Fine for metrics or debug logs |
| At least once | "Messages are never lost but may be redelivered" | The default for almost everything |
| Exactly once | "Each message is processed once and only once" | It exists, but always with conditions |
The scenario in the animation happens in production: the consumer processes, crashes before confirming, and the message is delivered again. AWS says it plainly about SQS: there's no "absolute guarantee" that a message won't be delivered more than once. RabbitMQ recommends making the consumer idempotent instead of trying to deduplicate everything. BullMQ warns that a job can run again if the worker crashes.
Idempotent means doing it twice gives the same result as doing it once. Charging a card isn't idempotent by nature; charging with a key the payment gateway recognizes as "already processed" is. This topic deserves its own article, and it will get one.
And "exactly once"? It always comes with an asterisk:
- In Kafka, it holds within Kafka itself (read, transform and write to another topic in the same transaction). With an external database or API, it depends on that system cooperating.
- In Google Pub/Sub, it's optional, only for pull subscriptions and in the same region.
- In SQS FIFO, a repeated send within 5 minutes doesn't duplicate, but consumption can still repeat.
The Tools
RabbitMQ: The Router
RabbitMQ (version 4.4.1, from November 16, 2026, MPL 2.0 license) is the classic broker. What sets it apart is routing: the producer doesn't publish straight to a queue, it publishes to an exchange, which decides which queues the message goes to.
- Direct: delivers by the exact routing key.
- Topic: delivers by pattern, like
pedido.*.pago. - Fanout: copies to every bound queue, ignoring the key.
To avoid losing messages when a server goes down, the current standard is quorum queues, replicated with the Raft algorithm: the producer only gets the confirmation after a majority of replicas have written it. In 4.0, the old mirroring of classic queues was removed for good. In 4.4, quorum queues got native delayed messages, something that used to require a plugin.
Two details that catch people: without acks, delivery is "at most once"; and, since 4.0, a message that fails 20 times in a quorum queue is dropped if you haven't configured a dead-letter exchange.
When to use it: routing by event type, several consumers with different interests, a standard protocol (AMQP) across different languages.
Apache Kafka: The Distributed Log
Kafka (version 4.4.0, from October 22, 2026, Apache 2.0 license) isn't a queue in the classic sense. It's a partitioned log: each topic is split into partitions, each partition is an ordered sequence, and messages stay there until retention expires.
Three rules explain almost everything:
- Order is guaranteed within the partition, not across the topic. That's why you use a key (the order ID, for example): messages with the same key land in the same partition and arrive in order.
- In a consumer group, each partition has only one reader. Six partitions allow at most six consumers in parallel in that group. The seventh sits idle.
- Different groups read independently. Finance and the dashboard read the same topic, each with its own offset.
Two recent changes matter. Kafka 4.0 (March 2025) retired ZooKeeper: the cluster runs on KRaft only, and anyone on the old setup has to migrate before upgrading. And share groups (the "Queues for Kafka" project, KIP-932) became production ready in 4.2: several consumers can split the same partition, with per-message acknowledgment, closer to a queue. The project document itself warns that this doesn't turn Kafka into a queue, and that order can break on redeliveries.
What Kafka doesn't have natively, as far as the 4.4 documentation shows: delayed messages, and a DLQ in the classic consumer (it exists in Kafka Connect and in share groups).
When to use it: very high volume, events consumed by several systems, a need to reprocess history, data streaming.
Amazon SQS: The Serverless Queue
SQS is managed by AWS: there's no server to maintain. The consumer fetches messages, processes them and deletes them explicitly.
- Standard: "at least once" delivery, best-effort ordering, nearly unlimited throughput.
- FIFO: strict order per message group (
MessageGroupId) and deduplication on send within 5 minutes. It has a ceiling: without high throughput mode, 300 transactions per second per action (3,000 messages with batches of 10).
The core concept is the visibility timeout: when a consumer takes a message, it becomes invisible for a while (30 seconds by default, up to 12 hours). If the consumer doesn't delete it before the deadline, it goes back to the queue. Too short a timeout causes duplicate processing; too long delays the next attempt.
| SQS limit | Value |
|---|---|
| Message size | 1 MiB (it was 256 KiB until August 2025) |
| Retention | 4 days by default, up to 14 days |
| Delivery delay | up to 15 minutes |
| Standard price (US East, N. Virginia) | US$ 0.40 per million requests, with 1 million free per month |
Watch the bill: each 64 KB chunk counts as one request, so a 1 MiB message counts as 16. To send the same message to several queues, the partner is SNS: an SNS topic pushes a copy to each subscribed SQS queue.
When to use it: you're already on AWS, want zero operations, have variable throughput.
BullMQ: The Node Job Queue
BullMQ (version 6.7.8, MIT license, around 14 million weekly downloads on npm) is a library, not a server. It uses Redis (and, since version 6, from July 2026, PostgreSQL too) to store jobs, and ships with what an app usually needs:
import { Queue, Worker } from 'bullmq';
import IORedis from 'ioredis';
const connection = new IORedis({ maxRetriesPerRequest: null });
const emails = new Queue('emails', { connection });
// Try 5 times, waiting longer between each attempt
await emails.add('boas-vindas', { usuarioId: 42 }, {
attempts: 5,
backoff: { type: 'exponential', delay: 1000 },
delay: 60_000, // only after 1 minute
});
new Worker('emails', async (job) => {
await enviarEmail(job.data.usuarioId);
}, { connection });Priority, delayed jobs, retries with growing waits, rate limiting, cron scheduling and dependencies between jobs (flows) come out of the box. If you're upgrading to 6: ioredis is now installed separately, and the old repeat option was dropped in favor of job schedulers.
When to use it: a Node app that already has Redis and needs background tasks, like email, reports and image processing. It's the simplest choice on this list.
Redis: Three Ways, One That Loses Messages
Redis shows up in almost every conversation about queues, and it has three different features that people mix up:
| Feature | Stores the message? | Guarantee | Good for |
|---|---|---|---|
List (LPUSH/BRPOP) |
Yes | Lost if the consumer crashes after popping it | Simple queue; use BLMOVE to make it reliable |
| Pub/Sub | No | At most once | Real-time notices where losing one doesn't matter |
| Streams | Yes | At least once, with groups and XACK |
A real queue, with redelivery |
The Redis documentation is blunt about Pub/Sub: if the subscriber can't handle the message, it's "lost forever". Using Pub/Sub as a task queue is one of the most common mistakes I see.
About the license: Redis 8 went back to offering an open source option (AGPLv3), after a period when it only had restrictive licenses. In the meantime Valkey was born, a Linux Foundation fork under the BSD license, backed by AWS and Google Cloud, which started from the Redis 7.2.4 code.
Second Tier: Worth Knowing
- NATS with JetStream: a lightweight binary that does pub/sub, request and reply and, with JetStream, a persistent queue with redelivery. Good if you want few pieces to run.
- Google Cloud Pub/Sub: Google's managed equivalent, with native fan-out, messages up to 10 MB and optional "exactly once".
- Azure Service Bus: Microsoft's managed broker, strong on enterprise features: sessions for ordering, a DLQ on every queue, scheduled delivery and transactions.
- Apache Pulsar: combines queue and log, with subscription types ranging from exclusive to key-shared, and native delayed delivery.
- Redpanda: compatible with the Kafka API, written in C++, no external dependencies. Check the license before adopting it.
- A queue in Postgres itself:
SELECT ... FOR UPDATE SKIP LOCKED, the pgmq extension or the pg-boss library. If the project already has Postgres and volume is moderate, you skip a new piece, and the task goes into the same transaction as the order.
Side by Side Comparison
| RabbitMQ | Kafka | SQS | BullMQ | Redis Streams | |
|---|---|---|---|---|---|
| Model | Queue with routing | Partitioned log | Managed queue | Job queue | Simple log |
| Reading deletes? | Yes (queues) | No | Yes, on delete | Yes | No, until trimmed |
| Order | Per queue | Per partition | FIFO per group | Per queue, with priority | Per stream |
| Native delay | Yes (4.4) | No | Up to 15 min | Yes | No |
| DLQ | Dead-letter exchange | Only Connect and share groups | Yes | Failed jobs queue | Manual |
| Operations | You run it | You run it (or managed) | Zero | Redis | Redis |
Poison Messages and the Dead-letter Queue
A message with invalid data always fails. With no limit, it goes back to the queue forever, burns processing and can block the ones behind it.
The recipe is the same in every tool: retry with growing waits (exponential backoff), limit the number of attempts and divert to a DLQ whatever goes over the limit. Then someone looks at the DLQ, fixes the cause and resends. The resilience patterns article explains retry and backoff in detail.
Two SQS gotchas: in a Standard queue, the DLQ retention clock starts at the original send, so the DLQ needs a longer retention than the source; and, in a FIFO queue, moving a message to the DLQ can break the order.
The Problem a Queue Doesn't Solve Alone: The Outbox
A classic bug: the code saves the order to the database and then publishes to the queue. If the process crashes between those two lines, the order exists and the event never goes out. If you flip the order, you can publish an event for an order that was never saved.
The outbox pattern, described by Chris Richardson, solves this: the message is written to a table in the database itself, in the same transaction that saves the order. A separate process reads that table and publishes to the broker. Since that process can publish the same message twice, the consumer still has to be idempotent. That's why a queue in Postgres (pg-boss, pgmq) is so appealing: the task is born inside the transaction.

How to Choose
| If you... | Start with |
|---|---|
| Have a Node app with Redis and need background tasks | BullMQ |
| Already use Postgres and volume is moderate | pg-boss or pgmq |
| Are on AWS and don't want to maintain servers | SQS (and SNS for fan-out) |
| Need to route messages by type to different consumers | RabbitMQ |
| Need to store events, reprocess and handle very high volume | Kafka |
| Want something light for lots of small services | NATS |
And the rule that applies to all of them: start with the simplest thing that works. Kafka for sending a welcome email is like renting a truck to deliver a letter.
Quick check
Frequently Asked Questions
Are queues and messaging the same thing?
Messaging is the broad concept: systems exchanging messages asynchronously. A queue is one form of it, for tasks that someone does once. Pub/sub and event logs are others.
Do I need Kafka?
If you're asking, probably not. Kafka shines with very high volume, many consumers of the same event and a need to reprocess history. For an app's background tasks, BullMQ, SQS or a queue in Postgres do the job with far less operations work.
Can Redis work as a queue in production?
Yes, with the right feature: Streams or lists with BLMOVE, and persistence configured. Pub/Sub, no. Libraries like BullMQ already do that work for you.
RabbitMQ or Kafka?
RabbitMQ when the message is a task and routing matters. Kafka when the message is an event that several systems consume and that you want to keep. Plenty of companies use both.
How do I test code that uses a queue?
Test the consumer as a pure function with the input message, and the full flow with the real broker in a container. The back-end testing guide shows how to set up integration tests with containers.
References
Official documentation checked on November 21, 2026:
- RabbitMQ: reliability, quorum queues, AMQP concepts and 4.0 release notes
- Apache Kafka: design, 4.0 announcement, 4.2 announcement and KIP-932
- Amazon SQS: Standard queues, visibility timeout, quotas, DLQ and pricing
- Amazon SNS with SQS
- BullMQ: documentation and version 6.0.0
- Redis: Pub/Sub, Streams, LMOVE and licenses
- Valkey, Linux Foundation
- NATS JetStream, Google Cloud Pub/Sub, Azure Service Bus, Apache Pulsar and Redpanda
- pgmq, pg-boss and PostgreSQL: SELECT with SKIP LOCKED
- Transactional outbox, Chris Richardson