tencent cloud

Create Exchange
Last updated: 2025-08-11 10:37:21
Create Exchange
Last updated: 2025-08-11 10:37:21
In a RabbitMQ cluster, the Exchange is responsible for receiving and distributing messages. When a producer sends a message, it is not directly sent to the Queue but first to the Exchange. The Exchange searches for a matching Queue based on the Routing Key: if found, the message is stored; if not found, the message is either discarded or sent to the Standby Exchange.
Different types of exchanges (such as Direct, Fanout, Topic) use different routing rules to determine how messages are distributed. For detailed routing rules, refer to Exchange.

Restrictions and Limitations

Limit Type
Open-Source Managed'}
Serverless Edition
Quantity Limit
A Vhost supports creating a maximum of 1,000 Exchanges.
A Vhost supports creating a maximum of 100 Exchanges.
Default Exchange Limit
After creation, a Vhost has 8 preset default Exchanges: (AMQP default exchange), amq.direct, amq.fanout, amq.headers, amq.match, amq.rabbitmq.event, amq.rabbitmq.trace, amq.topic. They cannot be deleted. Among them:
The AMQP default exchange is bound by default to each Queue, with the routing key equal to the Queue Name. Its binding relationship is unable to cancel or delete.
amq.rabbitmq.event is used for event query and is bound by default to the default Queue named tdmq_event_handle.
amq.rabbitmq.trace is used for message trace.
After creation, a Vhost has 1 preset default Exchange named "amq.default", which cannot be deleted.

Prerequisites

The corresponding Vhost has been created. For the directions, see Create a Vhost.

Operation Steps

1. Log in to the TDMQ RabbitMQ Console.
2. Select Cluster Management > Exchange in the left sidebar, choose a Vhost, then click Create to enter the Exchange creation page.
3. In the Create Exchange dialog box, enter the following information.
OpenOpen-Source Managed'}
Serverless Edition
Parameter
Description
Current Vhost
Indicates which Vhost the Exchange is being created for.
Exchange Name
Fill in the Exchange Name, comply with the naming rule: 1-64 characters, can only contain letters, numbers, ".", "-", and "_".
The Exchange name cannot be modified after creation.
routing type
Including direct, fanout, topic, and headers four types. The routing type cannot be modified after selection. For more details about routing types, refer to Exchange.
direct: This type of Exchange routes messages to the Queue where the RoutingKey and BindingKey fully match.
fanout: This type of Exchange will route messages to ALL bound queues.
topic: This type of Exchange supports multi-condition match and fuzzy matching, routing messages to bound Queues via Routing Key pattern matching and string comparison.
headers: Irrelevant to the Routing Key, the matching mechanism matches the Headers attribute information in the message. Declare a key-value pair map before binding the Queue to the Headers Exchange, and use this map object to bind the message queue to the switch. When a message is sent to RabbitMQ, its Headers are matched with the specified key-value pairs during Exchange binding. If fully matched, the message will be routed to the queue; otherwise, it will not.
X-Delayed-Message: This is a custom Exchange type used to implement delayed message delivery. When sending a message to an X-Delayed-Message switch, you can set a delay time for the message. RabbitMQ will route the message to its bound queue after the delay time ends. This kind of switch allows you to control when messages are transmitted to consumers when sending a message, thereby achieving scheduled and delayed processing.
Note:
To create this type of Exchange, see the following instructions:
**Note:** The X-Delayed-Message type is not a built-in type in RabbitMQ. It can be achieved by enabling the plugin **RabbitMQ_Delayed_Message_exchange**. For details, see Plugin Manager. After enabling the plugin, you can choose the X-Delayed-Message type when newly created in the console.
Durable
Whether to enable Exchange persistence:
If set to true, the Exchange still exists after service restart;
If set to false, the Exchange will be deleted after service restart and needs to be rebuilt.
AutoDelete
Whether to enable auto-delete Exchange:
If set to true, the Exchange will be automatically deleted after the last Queue bound to it is disassociated.
If set to false, the Exchange will not be deleted after the last Queue bound to it is disassociated.
Internal
Whether Exchange is for RabbitMQ internal use:
If set to true, the Exchange cannot be used directly by Producer. Publishing messages directly to it will return an error. It can form a route chain by binding to other Exchanges or Queues.
Exchange Instructions
Fill in the Exchange description, up to 128 characters.
Add Standby Exchange
Optional, default to non-use of Standby Exchange. If the incapability of route of messages sent to the main Exchange, they will be sent to the designated Standby Exchange here.
Parameter
Description
Current Vhost
Indicates which Vhost the Exchange is being created for.
Exchange Name
Fill in the Exchange Name, comply with the naming rule: 1-64 characters, can only contain letters, numbers, ".", "-", and "_".
The Exchange name cannot be modified after creation.
routing type
including direct, fanout, topic, and headers four types. The routing type cannot be modified after selection. For more details about routing types, refer to Exchange.
direct: This type of Exchange routes messages to the Queue where the RoutingKey and BindingKey fully match.
fanout: This type of Exchange will route messages to ALL bound queues.
topic: This type of Exchange supports multi-condition match and fuzzy matching, routing messages to bound Queues via Routing Key pattern matching and string comparison.
headers: Irrelevant to the Routing Key, the matching mechanism matches the Headers attribute information in the message. Declare a key-value pair map before binding the Queue to the Headers Exchange, and use this map object to bind the message queue to the switch. When a message is sent to RabbitMQ, its Headers are matched with the specified key-value pairs during Exchange binding. If fully matched, the message will be routed to the queue; otherwise, it will not.
Exchange Instructions
Fill in the Exchange description, up to 128 characters.
4. Click Submit to complete Exchange creation. The created Exchange will appear in the list.


Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback