Skip to main content
Definition Website Computer and Technology

Message Queue

Subject: Computer and Technology noun /ˈmɛs.ɪdʒ ˌkjuː/ 1 definition

  1. Definition (noun)

    Entry #74 · Updated

    A Message Queue (MQ) is an asynchronous inter-process or inter-service communication mechanism that temporarily stores discrete data payloads—called messages—in a managed buffer between sender and receiver applications. Producers append messages to the queue and immediately resume execution without waiting for a reply, while consumers retrieve, process, and acknowledge those messages independently at their own capacity. By decoupling components in both time and network location—unlike synchronous request-response protocols such as HTTP or direct RPC calls—a message queue absorbs traffic bursts, prevents cascading failures when downstream workers slow down or restart, and can provide durable delivery guarantees even when producers or consumers are temporarily offline.

    Common Types

    • Point-to-Point (Work) Queues: Deliver each message to exactly one consumer from a pool of competing workers, enabling parallel task processing and horizontal scaling without duplicate work.

    • Publish-Subscribe (Fan-Out) Queues: Route copies of each message published to a topic or exchange into separate subscriber queues, allowing multiple independent services to react to the same event concurrently.

    • Priority Message Queues: Dispatch messages according to explicit priority metadata rather than strict arrival order, ensuring time-sensitive payloads preempt lower-priority backlog items.

    • Dead-Letter Queues (DLQs): Isolate messages that exceed a maximum retry count or expiration threshold, preventing unprocessable payloads from stalling active queues while preserving them for inspection and replay.

    Example

    When a customer completes checkout on an e-commerce site, the order service commits the purchase to its database, publishes a JSON order.created payload to a RabbitMQ message queue, and immediately returns an HTTP 202 Accepted confirmation to the browser. Three background worker instances pull messages from the queue at their own pace to generate PDF invoices and dispatch confirmation emails, retrying any failed job up to three times before routing unprocessable payloads to a dead-letter queue.