Configure the lock provider

First steps

  1. Log in to the Magento server as, or switch to, a user with permissions to write to the Magento file system. See switch to the Magento file system owner.

    If you use the bash shell, you can use the following syntax to switch to the Magento file system owner and enter the command at the same time:

    su <Magento file system owner> -s /bin/bash -c <command>

    If the Magento file system owner does not allow logins, you can do the following:

    sudo -u <Magento file system owner>  <command>
  2. To run Magento commands from any directory, add <magento_root>/bin to your system PATH.

    Because shells have differing syntax, consult a reference like

    Sample bash shell for CentOS:

    export PATH=$PATH:/var/www/html/magento2/bin

    Optionally, you can run the commands in the following ways:

    • cd <magento_root>/bin and run them as ./magento <command name>
    • <magento_root>/bin/magento <command name>
    • <magento_root> is a subdirectory of your web server docroot. Need help locating the docroot?

In addition to the command arguments discussed here, see Common arguments.


Before you run this command, you must do all of the following or you must install the Magento software:

Configure the consumers behaviour

Command usage

magento setup:config:set [--<parameter_name>=<value>, ...]

Parameter descriptions

Name Value Required?  
  --consumers-wait-for-messages Should consumers wait for a message from the queue? 1 - Yes, 0 - No No

0—Consumers process available messages in the queue, close the TCP connection, and terminate. Consumers do not wait for additional messages to enter the queue, even if the number of processed messages is less than the --max_messages value specified during starting consumers.

1—Consumers continue to process messages from the message queue until reaching the maximum number of messages (the value specified for --max_messages on the queue:consumers:start command) before closing the TCP connection and terminating the consumer process. If the queue empties before reaching --max_messages the consumer waits for more messages to arrive. If you use workers to run consumers instead of using a cron job, set this variable to 1.