Set up RabbitMQ service
The MQF uses RabbitMQ as the messaging broker, which provides a scalable platform for sending and receiving messages. It also includes a mechanism for storing undelivered messages. RabbitMQ is based on the Advanced Message Queuing Protocol (AMQP) 0.9.1 specification.
We support RabbitMQ version 3.5.
If you prefer using an existing AMQP-based service, like RabbitMQ, instead of relying on Magento Commerce Cloud to create it for you, use the
QUEUE_CONFIGURATION environment variable to connect it to your site.
You can use the following instructions for service setup on Magento Commerce Cloud Pro Integration environments and Starter environments, including
master branch. You must submit a support ticket to configure the service on Pro Production and Staging environments. See Services.
Add RabbitMQ in services.yaml and .magento.app.yaml
To enable RabbitMQ, add the following code with your installed version and allocated disk space in MB to the
1 2 3 rabbitmq: type: rabbitmq:<version> disk: 1024
To configure the relationships for the environment variable, set a relationship in your
.magento.app.yaml file. For example:
1 2 relationships: rabbitmq: "rabbitmq:rabbitmq"
Merge and deploy the code to set the configurations for RabbitMQ. For information on how these changes affect your environments, see
Connect to RabbitMQ for debugging
For debugging purposes, it is useful to directly connect to a service instance in one of the following ways:
- Connect from your local development environment
- Connect from the application
- Connect from your PHP application
Connect from your local development environment
You can do this using SSH tunneling:
Use SSH to log in to the Integration environment with RabbitMQ installed and configured.
Log in to the Magento Cloud CLI and project:
Open a tunnel to the application.
Enable local port forwarding to RabbitMQ.
ssh -L <port-number>:mq.internal:<port-number> <project-ID>-<branch-ID>@ssh.us.magentosite.cloud
While the session is open, you can start a RabbitMQ client of your choice from your local workstation, configured to connect to the
localhost:<portnumberusing the username and password you found in the relationship variable. For this example, you would use
Connect from the application
To connect to RabbitMQ running in an application, you need to install a client such as amqp-utils as a project dependency in your
1 2 3 dependencies: ruby: amqp-utils: "0.5.1"
Then, when you log in to your PHP container, you enter any
amqp- command available to manage your queues.