The message queue topology can only be configured after Magento Community Edition has been installed and before Magento Enterprise Editions has been installed.
Each module that is to be a publisher must be configured as such. If you want a module to use the MQF, create a <module>/etc/queue.xml file and define the publisher, consumers, exchanges and bindings. 
Edit the queue.xml file
The queue.xml file can contain the following elements:
- publisher
- topic
- consumer
- bind
Required elements
Each queue.xml file must contain the following lines:
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework-message-queue:etc/queue.xsd">
.
.
.
</config>publisher element
The publisher element configures the type of connection and the exchange to publish to. By default, Magento uses one exchange. The name of exchange is a part of the publisher configuration. However multiple exchanges are supported, based on the AMQP model.
| Parameter | Description | 
|---|---|
| name | A unique identifer for the publisher. The value is specified in a topicelement. The default system publisher name is `default`. | 
| connection | If RabbitMQ is to used to manage the queue, then the value must be rabbitmq. The value can also bedbor the name of a custom adapter. | 
| exchange | The name of the exchange to publish to. The value is referenced from the bindelement. The default system exchange name is `magento`. | 
topic element
Configuring the topic element defines the interface that processes the message and assigns a publisher.
| Parameter | Description | 
|---|---|
| name | The name assigned to the topic. The format should be  Examples:  The value is specified in a  | 
| schema | The interface that describes the structure of the message. It should be in the format of a Data Interface from the Service Contracts. For example,  You can also specify a service method signature, such as  | 
| publisher | The nameof apublisher. | 
consumer element
Each consumer elements maps the receiver of a message to a specific queue. The class and method parameters indicate what receives and processes the message.
| Parameter | Description | 
|---|---|
| name | The name of the consumer. The value should be the same as the magic method that to be used as a callback. | 
| queue | Defines the queue name to send the message to. This value is used in the definition of a bindelement. | 
| connection | Must be rabbitmqor other value specified in the `connection` parameter in of a publisher. | 
| class | The path to a Magento class that consumes the message. | 
| method | The method within the specified classthat processes the message. | 
| max_messages | Specifies the maximum number of messages to consume. | 
bind element
The bind elements link topics to queues and exchanges, defining the message queue topology. A topic can be sent to any number of queues.
| Parameter | Description | 
|---|---|
| queue | The nameof a queue defined in aconsumerelement. | 
| exchange | The nameof an exchange defined in apublisherelement. | 
| topic | The nameof a topic defined in atopicelement. You can specify an asterisk (*) or pound sign (#) as wildcards. | 
Sample `queue.xml` file
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../../lib/internal/Magento/Framework/Amqp/etc/queue.xsd">
    <publisher name="test-publisher-1" connection="rabbitmq" exchange="magento"/>
    <publisher name="test-publisher-2" connection="db" exchange="magento"/>
    <topic name="customer.created" schema="Magento\Customer\Api\Data\CustomerInterface" publisher="test-publisher-1"/>
    <topic name="customer.deleted" schema="Magento\Customer\Api\Data\CustomerInterface" publisher="test-publisher-2"/>
    <consumer name="customerCreatedListener" queue="test-queue-1" connection="rabbitmq" class="Data\Type" method="processMessage"/>
    <consumer name="customerDeletedListener" queue="test-queue-2" connection="db" class="Other\Type" method="processMessage2" max_messages="98765"/>
    <bind queue="test-queue-1" exchange="magento" topic="customer.created" />
    <bind queue="test-queue-2" exchange="magento" topic="customer.deleted" />
</config>
Find us on