Skip to content
IT glossary
BackendUpdated December 3, 2026

Message queue

Очередь сообщений

A message queue holds work or event data until a program is ready to process it. The sender can move on without waiting for the work to finish.

Also known as: брокер сообщений, message broker

What is a message queue?

A message queue lets one part of a system hand work to another without waiting for it to finish. A web app, for example, can accept an image upload while a separate worker generates thumbnails in the background. The worker doesn't have to be ready at the moment the app submits the job, provided the messaging system can accept and retain it.

The queue and the message broker are different things. The queue holds pending messages. The broker is the service that accepts messages and manages routing and delivery. One broker, such as RabbitMQ, can manage many queues.

From publish to acknowledgment

A producer publishes a message containing the data a consumer needs, such as a job ID and a reference to a file. When multiple workers consume from the same queue, they generally share the work: a given delivery goes to one worker, not all of them. In an acknowledgment-based setup, the worker sends an ack after processing. If it loses its connection first, the broker can redeliver the unacknowledged message.

A broker's confirmation to the producer is separate from a worker's acknowledgment. The first can confirm that the messaging system accepted a publication under its configured guarantees. It does not mean a worker ran the job, and survival across a broker restart depends on the system's durability settings.

Example: generating a thumbnail

Suppose a worker writes a thumbnail to storage and crashes before sending ack. Another worker may get the same job and run it again. If both attempts write to the same output key derived from the job ID, they need not create two thumbnail files. This is one way to make the write idempotent: repeating it has the same intended effect as doing it once.

A temporary storage outage is worth retrying with a delay. An invalid file reference is unlikely to improve on the next attempt. After a bounded number of retries, the system can move the failed message to a dead-letter queue for inspection rather than retrying indefinitely.

When to use one and what to watch

A queue is useful for background jobs and short bursts of traffic. It buys time, not capacity: if work arrives faster than workers can clear it for a sustained period, the backlog and wait time grow. Queue depth and the age of the oldest waiting message help show whether workers are keeping up.

Don't assume FIFO delivery means FIFO completion. Two workers may start jobs in arrival order and finish them in reverse order. Also distinguish a shared work queue from publish/subscribe: workers on one queue divide up the jobs, while separate subscriptions can each receive a copy of an event.

In interviews

Expect to explain what happens if the consumer fails after writing a result but before acknowledging the message. State where duplicates can arise, then describe how you'd make the side effect safe to repeat. Saying “the broker retries” doesn't address what happens to the result already written.