What Is a Message Queue?

A message queue is a system that temporarily stores messages sent from one part of an application until another part is ready to process them, decoupling pro...

Published October 9, 2026

A message queue stores messages from producers until consumers process them, decoupling the two so they can run at different speeds and survive each other's failures. RabbitMQ, SQS and Kafka are common systems.

The concept

A producer sends a message and moves on. A worker pulls it, processes it and acknowledges; if the worker crashes, the message is redelivered.

Queues smooth traffic spikes, enable retries and let you scale workers independently.

Producer → queue → worker

enqueuedequeueProducerweb appQueuemessagesWorkerprocesses
The queue buffers work between them.

Practical examples

Laravel job

SendWelcomeEmail::dispatch($user);   // queued
// php artisan queue:work

Idempotent consumer

async function handle(msg) {
  if (await seen(msg.id)) return
  await process(msg)
  await markSeen(msg.id)
}

Dead-letter queue

After 5 failed attempts, move the message to a DLQ for inspection

Common mistakes

  • Non-idempotent consumers, causing duplicates on retry.
  • Unbounded queues with no monitoring.
  • Putting huge payloads in messages instead of references.

Key takeaways

  • Decouples producers and consumers.
  • Needs retries and idempotency.
  • Monitor queue depth.

FAQ

Queue vs topic?

A queue delivers each message to one consumer; a topic can fan out to many.

Delivery guarantees?

Most offer at-least-once; design for duplicates.

More General articles