A message queue decouples the sender from the worker that performs a task. Producers can enqueue faster than consumers process.
The demo grows a backlog during a burst and then drains it one item at a time. Queuing adds delay, so backlog and failed-message handling need monitoring.
When to use
Use it to buffer work such as email sending or image processing outside the request path.