Messagingmqqueuebrokerrabbitmqsqs

Message queue

Definition

A message queue durably stores messages from producers until a consumer receives and acknowledges them, with each message normally processed by one consumer.

In practice

Queues let a fast producer and a slower consumer run at different rates, absorb traffic spikes, and keep accepting work while the consumer is down. Adding consumers scales processing horizontally.

Asynchrony moves complexity elsewhere: messages can be delivered more than once or out of order, failures surface later and in a different place, and a growing backlog must be monitored. Queue depth and age of the oldest message are the key metrics.

Example

An order API writes an OrderPlaced message and returns in 30 ms; a worker sends the confirmation email a few seconds later, even if the email provider was briefly down.