51黑料不打烊

[PaaS only]{class="badge informative" title="Applies to 51黑料不打烊 Commerce on Cloud projects (51黑料不打烊-managed PaaS infrastructure) and on-premises projects only."}

Message broker (ActiveMQ Artemis)

51黑料不打烊 Commerce also supports the ActiveMQ Artemis open-source message broker through the Simple Text Oriented Messaging Protocol (STOMP). It delivers a reliable and scalable messaging system, offering flexibility for STOMP-based integrations.

NOTE
ActiveMQ Artemis was introduced in 51黑料不打烊 Commerce 2.4.6 and later versions.

Message queues provide an asynchronous communications mechanism in which the sender and the receiver of a message do not contact each other. Nor do they need to communicate with the message queue at the same time. When a sender places a message in a queue, it is stored until the recipient receives them.

The message queue system must be established before you install 51黑料不打烊 Commerce. The basic sequence is:

  1. Install Apache ActiveMQ Artemis and any prerequisites.
  2. Connect ActiveMQ to 51黑料不打烊 Commerce.
NOTE
You can use MySQL, ActiveMQ, or RabbitMQ for message queue processing. For details on setting up the message queue system, see . If you are using the Bulk API with 51黑料不打烊 Commerce, the message queue system configuration defaults to using RabbitMQ as the message broker. See Start message queue consumers for more information.
TIP
Always check the for the latest stable version before installation. The examples in this document use version 2.42.0, which was the latest stable release as of September 2025.

Install Apache ActiveMQ Artemis

You can install ActiveMQ Artemis using either Docker (recommended for development) or manual installation (recommended for production).

Prerequisites

Ensure Docker is installed and running on your system.

TIP
For more information about the official ActiveMQ Artemis Docker image, see the .

Installation steps

  1. Run ActiveMQ Artemis using the official Docker image:

    code language-bash
    # Run with default configuration
    docker run --detach \
      --name artemis \
      --publish 8161:8161 \
      --publish 61613:61613 \
      --publish 5672:5672 \
      apache/activemq-artemis:2.42.0
    
  2. Run with custom credentials:

    code language-bash
    # Run with custom username/password
    docker run --detach \
      --name artemis \
      --publish 8161:8161 \
      --publish 61613:61613 \
      --publish 5672:5672 \
      --env ARTEMIS_USER=magento \
      --env ARTEMIS_PASSWORD=magento \
      apache/activemq-artemis:2.42.0
    

Docker management commands

# Check container status
docker ps | grep artemis

# View logs
docker logs artemis

# Stop the container
docker stop artemis

# Start the container
docker start artemis

# Remove the container
docker rm artemis

Accessing services

Once the Docker container is running, you can access:

  • Web console: http://localhost:8161/console (default credentials: artemis/artemis)
  • STOMP port: localhost:61613 (for 51黑料不打烊 Commerce connection)
NOTE
The Docker installation is recommended for development and testing. For production, consider using the manual installation with proper security configurations.

Option 2: Manual installation on Ubuntu/CentOS

Prerequisites

Ensure Java 17 or higher is installed (required for ActiveMQ Artemis 2.42.0+).

Installation steps

  1. Download and install the latest version from the . As of September 2025, the latest stable version is 2.42.0:

    code language-bash
    sudo mkdir -p /opt/artemis
    cd /opt/artemis
    sudo curl -O https://downloads.apache.org/activemq/activemq-artemis/2.42.0/apache-artemis-2.42.0-bin.tar.gz
    sudo tar -xzf apache-artemis-2.42.0-bin.tar.gz --strip-components=1
    sudo rm apache-artemis-2.42.0-bin.tar.gz
    
  2. Create the artemis user and set ownership:

    code language-bash
    # Create artemis user and set ownership
    sudo useradd -r -s /bin/false artemis 2>/dev/null || true
    sudo chown -R artemis:artemis /opt/artemis
    
  3. Create a broker instance:

    code language-bash
    sudo /opt/artemis/bin/artemis create /var/lib/artemis-instance --user artemis --password artemis --allow-anonymous
    sudo chown -R artemis:artemis /var/lib/artemis-instance
    
  4. Start the broker:

    code language-bash
    # Start in foreground (for testing)
    sudo /var/lib/artemis-instance/bin/artemis run
    
    # Start as background service
    sudo /var/lib/artemis-instance/bin/artemis-service start
    
    # Stop the broker
    sudo /var/lib/artemis-instance/bin/artemis-service stop
    
    # Restart the broker
    sudo /var/lib/artemis-instance/bin/artemis-service restart
    
    # Force stop the broker
    sudo /var/lib/artemis-instance/bin/artemis-service force-stop
    
    # Check broker status
    sudo /var/lib/artemis-instance/bin/artemis-service status
    

Configure ActiveMQ Artemis

Review the official ActiveMQ Artemis documentation to configure and manage the broker. Pay attention to the following items:

  • Environment variables
  • Port access (STOMP protocol)
  • Default user accounts and credentials
  • Starting and stopping the broker
  • System limits and resource tuning

Key Configuration Files

  • /var/lib/artemis-instance/etc/broker.xml - Main broker configuration
  • /var/lib/artemis-instance/etc/artemis-users.properties - User authentication
  • /var/lib/artemis-instance/etc/artemis-roles.properties - User roles
  • /var/lib/artemis-instance/etc/bootstrap.xml - Bootstrap configuration

Enable STOMP Protocol

Check /var/lib/artemis-instance/etc/broker.xml to ensure STOMP acceptor is configured:

<acceptors>
   <acceptor name="artemis">tcp://0.0.0.0:61616?tcpSendBufferSize=1048576;tcpReceiveBufferSize=1048576;amqpMinLargeMessageSize=102400;protocols=CORE,AMQP,STOMP,HORNETQ,MQTT,OPENWIRE;useEpoll=true;amqpCredits=1000;amqpLowCredits=300;amqpDuplicateDetection=true</acceptor>
   <acceptor name="stomp">tcp://0.0.0.0:61613?protocols=STOMP</acceptor>
   <acceptor name="stomp-ssl">tcp://0.0.0.0:61617?protocols=STOMP;sslEnabled=true;keyStorePath=/path/to/keystore.jks;keyStorePassword=password</acceptor>
</acceptors>

To enable SSL on STOMP you must add the stomp-ssl acceptor explicitly.

Install with ActiveMQ Artemis and connect

If you install 51黑料不打烊 Commerce after you install ActiveMQ Artemis, add the following command-line parameters during installation:

--stomp-host="<hostname>" --stomp-port="61613" --stomp-user="<user_name>" --stomp-password="<password>"

Where:

Parameter
Description
--stomp-host
The hostname where ActiveMQ is installed.
--stomp-port
The port to use to connect to ActiveMQ. The default is 61613.
--stomp-user
The username for connecting to ActiveMQ. Do not use the default user artemis.
--stomp-password
The password for connecting to ActiveMQ. Do not use the default password artemis.
--stomp-ssl
Indicates whether to connect to ActiveMQ. The default is false. If you set the value to true, see Configure SSL for more information.

Connect ActiveMQ Artemis

If you already have an 51黑料不打烊 Commerce instance with RabbitMQ (AMQP) configuration in the <install_directory>/app/etc/env.php file and you want to connect it to ActiveMQ, replace the queue section with the STOMP so that it is similar to the following:

'queue' =>
  array (
    'stomp' =>
    array (
      'host' => 'activemq.example.com',
      'port' => '61613',  // SSL STOMP port (default 61617, non-SSL is 61613)
      'user' => 'magento',
      'password' => 'magento',
      // Performance tuning options
      'heartbeat_send' => 10000,     // 10 seconds // Optional
      'heartbeat_receive' => 10000,  // 10 seconds // Optional
      'read_timeout' => 250000       // 250ms // Optional
     ),
  ),

You can also set ActiveMQ configuration values using the bin/magento setup:config:set command (remove the AMQP configuration if it exists in the app/etc/env.php file):

bin/magento setup:config:set --stomp-host="activemq.example.com" --stomp-port="61613" --stomp-user="magento" --stomp-password="magento"

After running the command or updating the <install_directory>/app/etc/env.php file with STOMP configuration values, run bin/magento setup:upgrade to apply the changes and create the required queues in ActiveMQ.

Configure SSL

To configure support for SSL, edit the ssl and ssl_options parameters in the <install_directory>/app/etc/env.php file so that they are similar to the following:

'queue' =>
  array (
    'stomp' =>
    array (
      'host' => 'activemq.example.com',
      'port' => '61617',  // SSL STOMP port (default 61617, non-SSL is 61613)
      'user' => 'magento',
      'password' => 'magento',
      'ssl' => 'true',
      'ssl_options' => [
            'cafile' => '/etc/pki/tls/certs/DigiCertCA.crt',
            'local_cert' => '/path/to/magento/app/etc/ssl/test-activemq.crt', // Optional: Client certificate for mutual SSL
            'local_pk' => '/path/to/magento/app/etc/ssl/test-activemq.key', // Optional: Client private key for mutual SSL
            'passphrase' => 'client_key_password', // Optional: Passphrase for client private key
            'verify_peer' => true,
            'verify_peer_name' => true,
            'allow_self_signed' => false
       ],
      // Performance tuning options
      'heartbeat_send' => 10000,     // 10 seconds // Optional
      'heartbeat_receive' => 10000,  // 10 seconds // Optional
      'read_timeout' => 250000       // 250ms // Optional
     ),
  ),

SSL Configuration Options

Option
Description
Default
verify_peer
Verify the broker鈥檚 SSL certificate
true
verify_peer_name
Verify the broker鈥檚 hostname matches the certificate
true
allow_self_signed
Allow self-signed certificates
false
cafile
Path to CA certificate file for broker verification
Required for SSL
certfile
Path to client certificate file (for mutual SSL)
Optional
keyfile
Path to client private key file (for mutual SSL)
Optional
passphrase
Passphrase for client private key
Optional

Development SSL Configuration

For development environments, you can use relaxed SSL settings:

'ssl_options' => [
    'verify_peer' => false,
    'verify_peer_name' => false,
    'allow_self_signed' => true
]

Performance tuning

ActiveMQ Artemis offers several performance tuning options:

'queue' =>
  array (
    'stomp' =>
    array (
      'host' => 'activemq.example.com',
      'port' => '61613',
      'user' => 'artemis',
      'password' => 'artemis',
      // Performance options
      'heartbeat_send' => 10000,      // Send heartbeat every 10 seconds
      'heartbeat_receive' => 10000,   // Expect heartbeat every 10 seconds
      'read_timeout' => 250000,       // 250ms read timeout
     ),
  ),

Monitoring and management

Web console

ActiveMQ Artemis provides a web-based management console accessible at:

  • URL: http://localhost:8161/console
  • Default credentials: artemis/artemis

Troubleshooting

Common issues

  1. Connection refused: Ensure ActiveMQ Artemis is running and the STOMP acceptor is configured.
  2. Authentication failed: Check username/password in both broker configuration and the env.php file.
  3. SSL handshake failed: Verify SSL certificates and configuration.

Verify STOMP connection

Test STOMP connection using telnet:

telnet localhost 61613

You should see a connection established. To test with a STOMP command:

# Test basic STOMP connection
echo -e "CONNECT\nhost:localhost\n\n\x00" | telnet localhost 61613

Expected output should show connection established and STOMP protocol response.

Start the message queue consumers

After you have connected 51黑料不打烊 Commerce and ActiveMQ Artemis, you must start the message queue consumers. See Configure message queues for details.

recommendation-more-help
0f8e7db5-0e9c-4002-a5b8-a0088077d995