Setup RabbitMQ on MacOS X

Pretending you have installed RabbitMQ, you may have to execute the following steps to connect Magento and RabbitMQ.

Create Credentials & Configuration

To fix these issues or to create the connection if not already done, start by creating the RabbitMQ user and virtual host as well as setting the permissions with

rabbitmqctl add_user admin admin
rabbitmqctl add_vhost pacemaker
rabbitmqctl set_permissions -p pacemaker admin "." "." ".*"

In the commands above, we create a user with the username admin and the password admin.

Also, a virtual host for RabbitMQ with the name pacemaker has been created.

Then add the queue node to the Magento configuration under app/etc/env.php. With the username/password and virtual host values from above, this has to look like

return [
    'queue' => [
        'amqp' => [
            'host' => 'localhost',
            'port' => '5672',
            'user' => 'admin',
            'password' => 'admin',
            'virtualhost' => 'pacemaker',
            'ssl' => 'false'
        ]
    ],
];

After that, finalize the Magento setup with the following command:

bin/magento setup:upgrade

If this command is executed successfully, the queues within RabbitMQ are created, and the connection will be established.

To start the runner, enter the following command:

bin/magento queue:consumers:start pipelineRunner
pe setup rabbitmq on macosx rabbitmq gui
Figure 1. Additionally in the RabbitMQ GUI the queues should now be visible like

CLI status Update

To get a brief overview of running processes, which can be useful for local development and debugging, it is possible to execute a console command that displays the status of running pipelines on the console

bin/magento pipeline:status -w 2
pe pipeline status
Figure 2. Now it should render the following output

Issues with missing AMQP configuration

If you did not setup the RabbitMQ connection when installing Magento, you will receive one of the two errors below when you try to start the Pacemaker runner.

The message Unknown connection name amqp signals that the Magento configuration under app/etc/env.php is missing the AMQP connection

$ bin/magento queue:consumers:start pipelineRunner

In ConnectionTypeResolver.php line 43:

  Unknown connection name amqp

queue:consumers:start [--max-messages MAX-MESSAGES] [--batch-size BATCH-SIZE] [--area-code AREA-CODE]
[--pid-file-path PID-FILE-PATH] [--] <consumer>

Whereas the message ACCESS_REFUSED - Login was refused using the authentication mechanism AMQPLAIN. For details see the broker logfile. addresses an issue with the configured username/password in the configuration.

$ bin/magento queue:consumers:start pipelineRunner

In AbstractConnection.php line 689:

  ACCESS_REFUSED - Login was refused using the authentication mechanism AMQPLAIN.

For further details, please check the broker logfile.

queue:consumers:start [--max-messages MAX-MESSAGES] [--batch-size BATCH-SIZE] [--area-code AREA-CODE]
[--pid-file-path PID-FILE-PATH] [--] <consumer>