/ˈmɛs.ɪdʒ kjuː/
noun — “the post office for processes, delivering data one envelope at a time.”
Message Queue is a communication mechanism that allows processes or applications to exchange information asynchronously by sending messages to a queue rather than communicating directly. This decouples the sender from the receiver, enabling reliable data transfer, load balancing, and better concurrency management in complex systems.
In a typical Message Queue setup, a process posts a message to a queue maintained by the operating system or a middleware service. Another process retrieves messages from the queue when ready. The queue may operate in a first-in, first-out (FIFO) manner or follow priorities, ensuring that important messages are handled promptly. By design, Message Queues provide temporal decoupling, so the producer and consumer do not need to run simultaneously.
Message Queue is essential in distributed systems, microservices architectures, and real-time applications. It integrates with Shared Memory and Semaphore mechanisms for local synchronization while also supporting networked communication through brokers like RabbitMQ, Kafka, or ActiveMQ. These systems persist messages, guarantee delivery, and allow multiple consumers to process workloads concurrently.
Reliability is a core feature of Message Queues. Features like acknowledgment, retries, dead-letter queues, and message durability ensure that information is neither lost nor processed multiple times unintentionally. Developers can design robust pipelines where stages of computation are linked via queues, handling bursts of input gracefully without overwhelming any single process.
Conceptually, a Message Queue is like a bulletin board where each process drops a note. Other processes pick up notes at their convenience, read them, and act accordingly, avoiding collisions or lost instructions.
Message Queue is like sending your processes little postcards — except they can’t complain about your handwriting.
See Shared Memory, Semaphore, Pipe, I/O Stream, Process Management.