All posts

Magento message queue consumers: the workers nobody watches

Magento 2 puts a lot of work on a queue and lets separate worker processes, the consumers, pick it up later. That keeps admin saves and checkout fast. It also means that when the consumers stop, the work simply waits, and nothing on the storefront says so.

Free checkout scan

Enter your store address. A real browser adds a product to the cart and walks the checkout up to the payment step, like a customer, and shows you every step with a screenshot.

  • Free, no account
  • Stops before payment, no order
  • Nothing to install
· Updated · 3 min read
People standing in a line

What runs through the queue

With RabbitMQ or with the database queue that Magento uses when no broker is configured, these consumers come up most often in checkout-related problems:

ConsumerWhat it handlesWhen it stops
inventory.reservations.updateSalabilityStatusUpdates salable status after orders reserve stock (MSI)Products show the wrong availability
inventory.mass.updateMass source and stock changes from the adminStock edits never apply
product_action_attribute.updateUpdate attributes on many products at oncePrices or status changes hang
async.operations.allBulk and asynchronous REST API callsIntegrations look successful, nothing changes
exportProcessorAdmin data exportsExports never finish

List the consumers your installation actually has:

bash
bin/magento queue:consumers:list

How consumers get started

By default the cron job consumers_runner starts consumers every minute, each for a limited number of messages. The settings live in app/etc/env.php:

php
'cron_consumers_runner' => [
    'cron_run' => true,        // let cron start consumers
    'max_messages' => 10000,   // a consumer exits after this many
    'consumers' => [],         // empty = all consumers
],
Edit env.php in the deploy, not by hand on one server, then run bin/magento cache:flush.

So the first rule follows: if cron is down, consumers started by cron are down too. Check Magento cron before anything else.

cron_run set to false

Some hosts turn cron consumers off to save memory and never start them another way. Messages pile up quietly until someone notices that a mass update never applied.

Is the queue backing up?

On the database queue, count messages per status. A growing number of new or retry rows means nobody is consuming:

sql
SELECT q.name AS queue, s.status, COUNT(*) AS messages
FROM queue_message_status s
JOIN queue q ON q.id = s.queue_id
GROUP BY q.name, s.status
ORDER BY messages DESC;
-- status: 2 new, 3 in progress, 4 complete, 5 retry, 6 error

On RabbitMQ, ask the broker. The messages column should drain towards zero, and consumers should not be 0 on a queue that receives work:

bash
rabbitmqctl list_queues name messages consumers

Run them properly in production

Cron-started consumers are fine for small stores. Larger stores run the important consumers as long-lived processes under a supervisor, so they restart on failure and do not wait for the next cron minute:

ini
; /etc/supervisor/conf.d/magento-consumers.conf
[program:magento-reservations]
command=php /var/www/magento/bin/magento queue:consumers:start inventory.reservations.updateSalabilityStatus --max-messages=1000
user=magento
autorestart=true
stopwaitsecs=60
--max-messages makes the process exit after a batch; the supervisor starts a fresh one, which also releases memory.
  1. Pick the consumers. Run the ones tied to stock and orders as services; leave the rest to cron.
  2. Remove them from cron. List the remaining ones in consumers in env.php, so the same consumer is not started twice.
  3. Restart after each deploy. Consumers keep the old code in memory until they restart.
Restart after deploys

A long-running consumer that started before the deploy still runs the old classes. Add supervisorctl restart magento-reservations to the deploy script.

Watch it

Alert on the queue size, not only on whether a process exists: a consumer can run and still fail every message. The free MageSentinel Magento module checks cron, indexers and pending payments every 15 minutes; an end-to-end checkout check shows the result when stock or prices go wrong. Related: MSI salable quantity and Redis sessions and cache.

Check your own store now with the free Magento checkout test: it walks the checkout in a real browser and shows the step where it stops.

Find out your checkout broke before your customers do.

Real checkout checks for Magento and WooCommerce · free plan · no card requiredMagento checkout monitoring →
FAQ

Common questions

Still have a question?More answers, and a way to reach us.Support →
01What are Magento message queue consumers?

Worker processes that take queued tasks, such as stock reservations, mass attribute updates and asynchronous API calls, and run them outside the web request.

02How are Magento consumers started?

By default the cron job consumers_runner starts them every minute, controlled by cron_consumers_runner in env.php. In production, important consumers are often run under a supervisor with queue:consumers:start.

03How do I know consumers are stuck?

The queue keeps growing: new or retry rows in queue_message_status, or messages and zero consumers in rabbitmqctl list_queues.