Asynchronous configuration
When using the message queue, four configuration files are required in your component:
communication.xmlqueue_consumer.xmlqueue_topology.xmlqueue_publisher.xml
For more information, see Configure message queues.
Asynchronous and Bulk APIs are built on top of the REST API and use the Message Queue Framework for processing messages. To simplify development, the Asynchronous API auto-generates communication.xml and queue_publisher.xml. The Magento/WebapiAsync module provides queue_topology.xml and queue_consumer.xml.
communication.xml
Information about the auto-generation of communication.xml can be found in Topics in Asynchronous API
queue_publisher.xml
The queue_publisher.xml file is generated by the \Magento\WebapiAsync\Code\Generator\Config\RemoteServiceReader\Publisher class, which implements \Magento\Framework\Config\ReaderInterface and is injected into the \Magento\Framework\MessageQueue\Publisher\Config\CompositeReader constructor argument in the main di.xml file.
Copied to your clipboard<type name="Magento\Framework\MessageQueue\Publisher\Config\CompositeReader"><arguments><argument name="readers" xsi:type="array"><item name="asyncServiceReader" xsi:type="object" sortOrder="0">Magento\WebapiAsync\Code\Generator\Config\RemoteServiceReader\Publisher</item>...</argument></arguments></type>
The sort order is set to 0 and allows developers to change some aspects of the generated configuration in configuration readers such as queue_publisher.xml and env.php.
The \Magento\WebapiAsync\Code\Generator\Config\RemoteServiceReader\Publisher::read() method calls \Magento\AsynchronousOperations\Model\ConfigInterface::getServices() to get an array of REST API routes that can be executed asynchronously. It then dynamically resolves the connection name (db (default), amqp, or stomp for ActiveMQ Artemis) based on the env.php deployment configuration and defines the exchange as magento for each generated topic name.
queue_consumer.xml
The asynchronous/bulk API has one defined consumer which processes all asynchronous/bulk APIs messages.
Copied to your clipboard<consumer name="async.operations.all" queue="async.operations.all"consumerInstance="Magento\AsynchronousOperations\Model\MassConsumer"/>
The connection type (AMQP or STOMP) is determined automatically based on your env.php configuration.
queue_topology.xml
The message queue topology configuration links all auto-generated topic names with the async. prefix to the magento exchange. It defines the queue named async.operations.all as the destination for all messages.
Copied to your clipboard<exchange name="magento"><binding id="async.operations.all" topic="async.#" destination="async.operations.all"/></exchange>
The message queue connection is defined dynamically based on the deployment configuration in env.php. If AMQP or STOMP is configured for the queue, that connection is used. Otherwise, the database connection is used. Because the connection is resolved dynamically, explicit declarations are unnecessary in the message queue configuration files: queue_consumer.xml, queue_publisher.xml, queue_topology.xml.
ActiveMQ Artemis (STOMP) support was introduced in Adobe Commerce 2.4.5. For STOMP connections, use ANYCAST addressing mode for point-to-point message delivery and load balancing across multiple consumers.

