How does a message queue smooth out bursts?
A queue holds messages until a consumer can process them. Producers can submit work without waiting for each job to finish, while consumers handle it at their own pace.
Submit work
A producer sends a message, such as an image-resizing job. The queue accepts it so the producer can continue without waiting for the image to be resized.
Read the complete explanation +
Submit work
A producer sends a message, such as an image-resizing job. The queue accepts it so the producer can continue without waiting for the image to be resized.
Absorb a burst
If messages arrive faster than consumers process them, the backlog grows. The queue buffers the difference; it does not create extra processing capacity.
Process at a sustainable pace
Consumers receive queued messages when ready. A simple FIFO queue offers earlier messages first, although concurrent jobs can finish in a different order.
Acknowledge or retry
With manual acknowledgements, the consumer confirms a successful job. If its connection closes before acknowledgement, the broker can redeliver the message. Make processing idempotent so a duplicate does not repeat an unwanted effect.
About this visual model +
A marble run represents buffered work: a hopper supplies messages, a lane holds the backlog, a gate meters work to a consumer, and a receiving tray represents acknowledgement. Highlights explain the sequence; this view does not simulate deliveries.
A conceptual FIFO queue using manual acknowledgements. Multiple consumers, priorities and retries can change order. Queue capacity is finite, and consumers should tolerate duplicate delivery.
- Producer: A producer sends a message describing work to be performed.
- Waiting messages: A buffer holds pending work until a consumer has capacity.
- Consumer: A consumer receives a message and performs the requested work.
- Acknowledgement: After successful processing, an acknowledgement tells the broker the message can be removed.
Further reading: RabbitMQ queues ↗, Consumer acknowledgements ↗