[PaaS only]{class="badge informative" title="Applies to Adobe Commerce on Cloud projects (Adobe-managed PaaS infrastructure) and on-premises projects only."}

Set up ActiveMQ service

The Message Queue Framework (MQF) is a system within Adobe Commerce that allows a module to publish messages to queues. It also defines the consumers that receive the messages asynchronously.

The MQF can use ActiveMQ Artemis as the messaging broker, which provides a scalable platform for sending and receiving messages. It also includes a mechanism for storing undelivered messages. ActiveMQ Artemis supports the STOMP (Streaming Text Oriented Messaging Protocol) protocol for messaging.

ActiveMQ Artemis is available as an alternative to RabbitMQ for managing message queues. It is particularly useful when you need features specific to ActiveMQ or want to use STOMP protocol.

IMPORTANT
If you prefer using an existing message broker service, like ActiveMQ, instead of relying on Adobe Commerce on cloud infrastructure to create it for you, use the QUEUE_CONFIGURATION environment variable to connect it to your site.

Use the following instructions for service setup on Pro Integration environments and Starter environments, including the master branch.

NOTE
Submit an Adobe Commerce Support ticket to change the service configuration on Pro Production and Staging environments.

To enable ActiveMQ Artemis:

  1. Add the required name, type, and disk value (in MB) to the .magento/services.yaml file along with the installed ActiveMQ version.

    code language-yaml
    activemq-artemis:
        type: activemq-artemis:<version>
        disk: 1024
    
  2. Configure the relationships in the .magento.app.yaml file.

    code language-yaml
    relationships:
        activemq-artemis: "activemq-artemis:activemq-artemis"
    
  3. Add, commit, and push your code changes.

    code language-bash
    git add .magento/services.yaml .magento.app.yaml
    
    code language-bash
    git commit -m "Enable ActiveMQ Artemis service"
    
    code language-bash
    git push origin <branch-name>
    
  4. Verify the service relationships.

TIP
After initial service setup, you can change the software version for an installed service by updating the services.yaml and .magento.app.yaml configuration files. See Change service version for guidance on upgrading or downgrading a service.

Connect to ActiveMQ for debugging

For debugging purposes, you can 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

  1. Log in to the magento-cloud CLI and project:

    code language-bash
    magento-cloud login
    
  2. Check out the environment with ActiveMQ Artemis installed and configured.

    code language-bash
    magento-cloud environment:checkout <environment-id>
    
  3. Use SSH to connect to the Cloud environment:

    code language-bash
    magento-cloud ssh
    
  4. Retrieve the ActiveMQ connection details and login credentials from the $MAGENTO_CLOUD_RELATIONSHIPS variable:

    code language-bash
    echo $MAGENTO_CLOUD_RELATIONSHIPS | base64 -d | json_pp
    

    or

    code language-bash
    php -r 'print_r(json_decode(base64_decode($_ENV["MAGENTO_CLOUD_RELATIONSHIPS"])));'
    

    In the response, find the ActiveMQ information. The relationship name depends on how you configured it in your .magento.app.yaml file. For example, if you used activemq-artemis as the relationship name:

    code language-json
    {
       "activemq-artemis" : [
          {
             "password" : "guest",
             "ip" : "246.0.129.2",
             "scheme" : "stomp",
             "port" : 61616,
             "host" : "activemq-artemis.internal",
             "username" : "guest"
          }
       ]
    }
    
  5. Enable local port forwarding to ActiveMQ (if your project is located on a different region such as US-3, EU-5, or AP-3 region, substitute us-3/eu-5/ap-3 for us)

    code language-bash
    ssh -L <port-number>:activemq-artemis.internal:<port-number> <project-ID>-<branch-ID>@ssh.us.magentosite.cloud
    

    An example for accessing the ActiveMQ Artemis web console at http://localhost:8161 is:

    code language-bash
    ssh -L 8161:activemq-artemis.internal:8161 <project-ID>-<branch-ID>@ssh.us.magentosite.cloud
    
    note note
    NOTE
    ActiveMQ Artemis uses port 61616 for STOMP messaging and port 8161 for the web console.
  6. While the session is open, you can access the ActiveMQ Artemis web console at http://localhost:8161 using the username and password from the MAGENTO_CLOUD_RELATIONSHIPS variable.

Connect from the application

To connect to ActiveMQ running in an application, install a STOMP client library in your PHP application.

Connect from your PHP application

To connect to ActiveMQ using your PHP application, add a PHP STOMP library to your source tree. Adobe Commerce uses the STOMP protocol for ActiveMQ communication, and the configuration is automatically set up during deployment when ActiveMQ Artemis is detected as a configured service.

Protocol support

ActiveMQ Artemis in Adobe Commerce on cloud infrastructure uses the STOMP (Streaming Text Oriented Messaging Protocol) protocol:

  • STOMP: The messaging protocol used for queue operations (port 61616)
  • Web Console: Management interface accessible via HTTP (port 8161)

Differences from RabbitMQ

While both ActiveMQ Artemis and RabbitMQ serve as message brokers for Adobe Commerce, there are some differences:

  • Protocol: ActiveMQ Artemis uses STOMP protocol, while RabbitMQ uses AMQP
  • Configuration: When ActiveMQ Artemis is configured, Adobe Commerce automatically uses STOMP protocol
  • Priority: If both ActiveMQ and RabbitMQ are configured, ActiveMQ takes precedence for STOMP-based operations, while AMQP operations use RabbitMQ
  • Web Console: ActiveMQ provides a web-based management console for monitoring queues and messages

Queue configuration

When ActiveMQ Artemis is configured as a service, Adobe Commerce automatically configures the queue system to use the STOMP protocol. The configuration is written to the app/etc/env.php file during deployment:

'queue' => [
    'stomp' => [
        'host' => 'activemq-artemis.internal',
        'port' => '61616',
        'user' => 'guest',
        'password' => 'guest'
    ],
    'default_connection' => 'stomp'
]

You can override this configuration using the QUEUE_CONFIGURATION environment variable if needed.

recommendation-more-help
7c2b03ac-000c-497d-aba3-2c6dc720a938