Creates an exchange.
Request parameters
Parameter | Type | Required | Example | Description |
Action | String | Yes | CreateExchange | The operation that you want to perform. Set the value to CreateExchange. |
InstanceId | String | Yes | amqp-cn-v0h1kb9nu*** | The instance ID. |
VirtualHost | String | Yes | test | The name of the vhost in which you want to create the exchange. |
ExchangeName | String | Yes | DemoExchange | The exchange name. The exchange name must meet the following conventions:
|
ExchangeType | String | Yes | DIRECT | The exchange type. Valid values:
|
XDelayedType | String | No | DIRECT | The x-delayed-message exchange. You can use the x-delay header of a message to specify a period of time after which the message is delivered from an x-delayed-message exchange. Unit: milliseconds. The type of exchange to which messages in an x-delayed-message exchange are delivered is determined by the value of the x-delayed-type parameter. Valid values of the x-delayed-type parameter:
|
AutoDeleteState | Boolean | Yes | false | Specifies whether to enable automatic deletion. Valid values:
|
Internal | Boolean | Yes | false | Specifies whether the exchange is an internal exchange. Valid values:
|
AlternateExchange | String | No | DemoAE | The alternate exchange. An alternate exchange is used to receive messages that fail to be routed to queues from the current exchange. |
Response parameters
Parameter | Type | Example | Description |
RequestId | String | 021788F6-E50C-4BD6-9F80-66B0A19A**** | The request ID. |
Examples
Sample requests
http(s)://amqp-open.cn-hangzhou.aliyuncs.com/?Action=CreateExchange
&AutoDeleteState=false
&ExchangeName=DemoExchange
&ExchangeType=DIRECT
&InstanceId=amqp-cn-v0h1kb9nu***
&Internal=false
&RegionId=cn-hanghzou
&VirtualHost=test
&<Common request parameters>
Sample success responses
XML
format
HTTP/1.1 200 OK
Content-Type:application/xml
<CreateExchangeResponse>
<RequestId>021788F6-E50C-4BD6-9F80-66B0A19A6***</RequestId>
</CreateExchangeResponse>
JSON
format
HTTP/1.1 200 OK
Content-Type:application/json
{
"RequestId" : "021788F6-E50C-4BD6-9F80-66B0A19A6***"
}
Error codes
For a list of error codes, see Service error codes.