Edit in GitHubLog an issue
Thanks to comwrap GmbH for contributing this topic!

Asynchronous configuration

When using the message queue, four configuration files in your component must be updated:

  • communication.xml
  • queue_consumer.xml
  • queue_topology.xml
  • queue_publisher.xml

More information can be found in Configure message queues.

Asynchronous and Bulk APIs are built on top of the usual REST API and use the Message Queue Framework for processing messages. To ease development efforts, the Asynchronous API pre-generates the following configuration files:

  • communication.xml
  • queue_publisher.xml

and provides the queue_topology.xml and queue_consumer.xml files within the Magento/WebapiAsync module.


Information about the auto-generation of communication.xml can be found in Topics in Asynchronous API


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
1<type name="Magento\Framework\MessageQueue\Publisher\Config\CompositeReader">
2 <arguments>
3 <argument name="readers" xsi:type="array">
4 <item name="asyncServiceReader" xsi:type="object" sortOrder="0">Magento\WebapiAsync\Code\Generator\Config\RemoteServiceReader\Publisher</item>
5 ...
6 </argument>
7 </arguments>

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.

\Magento\WebapiAsync\Code\Generator\Config\RemoteServiceReader\Publisher::read() calls \Magento\AsynchronousOperations\Model\ConfigInterface::getServices() to get an array of all REST API routes which can be executed asynchronously. Then it defines the connection name as amqp and the exchange as magento for each generated topic name.


The asynchronous/bulk API has one defined consumer which processes all asynchronous/bulk APIs messages.

Copied to your clipboard
1<consumer name="async.operations.all" queue="async.operations.all" connection="amqp"
2 consumerInstance="Magento\AsynchronousOperations\Model\MassConsumer"/>


The message queue topology configuration links all auto-generated topic names with prefix async. to the magento exchange and defines the queue named async.operations.all as the destination for all messages.

Copied to your clipboard
1<exchange name="magento" connection="amqp">
2 <binding id="async.operations.all" topic="async.#" destination="async.operations.all"/>
Was this helpful?
  • Privacy
  • Terms of Use
  • Do not sell my personal information
  • AdChoices
Copyright © 2022 Adobe. All rights reserved.