Modifying Queue Properties

Last updated: 2019-07-05 12:21:52

PDF

1. API Description

This API (SetQueueAttributes) is used to modify the attributes of a message queue. Note that you cannot modify the name of a queue.

Domain for public network API request:cmq-queue-region.api.qcloud.com

Domain for private network API request:cmq-queue-region.api.tencentyun.com

  • region should be replaced by specific region: gz (Guangzhou), sh (Shanghai), bj (Beijing). The region value in the common parameter should be kept consistent with the one of the domain. In case of inconsistency, the domain region should prevail. The request should be sent to the region specified by the domain.
  • Requests for accessing via public network domain support both HTTP and HTTPS. Requests for accessing via private network only support HTTP.
  • Some of the input parameters are optional, so the default values are not required.
  • All output parameters will be returned to the user when the request is successful; otherwise, at least code, message, and requestId will be returned.

2. Input Parameters

The following request parameter list only provides API request parameters. For other parameters, refer to Common Request Parameters.

Parameter Name Required Type Description
queueName Yes String Queue name. This is unique under the same account in one region. The name of queue is a string with no more than 64 characters. It must start with letter, and the rest may contain letters, numbers and dashes (-).
maxMsgHeapNum No Int Maximum number of messages in the queue. The available value range during beta test is 1,000,000 - 10,000,000. It will be increased to 1,000,000-1,000,000,000 when officially launched. The default value is 10,000,000 during beta test, and 100,000,000 when officially launched.
pollingWaitSeconds No Int Waiting time for messages to be received when using long-polling. Value range is 0-30 seconds. Default is 0.
visibilityTimeout No Int Message visibility timeout. Value range is 1-43200 seconds (within 12 hours). Default is 30.
maxMsgSize No Int Maximum message length. Value range is 1024-65536 Byte (1-64 K). Default is 65536.
msgRetentionSeconds No Int How long the messages will be kept. Value range is 60-1296000 seconds (1 min-15 days). Default value is 345600 (4 days).
rewindSeconds No Int Maximum rewind time for messages. Value range is 0-msgRetentionSeconds. The max value equals to the time for which messages will be kept in the queue. 0 means message rewind is disabled.
## 3. Output Parameters
Parameter Name Type Description
code Int 0: Succeed, 4440: Queue does not exist. For the meanings of other returned values, please refer to Error Codes.
message String Error message.
requestId String ID of the request generated by server. When there is an internal error on the server, users can submit this ID to backend to locate the problem.
maxMsgHeapNum Int (Modified) Maximum number of messages in the queue.
pollingWaitSeconds Int (Modified) Waiting time for messages to be received when using long-polling.
visibilityTimeout Int (Modified) Message visibility timeout.
maxMsgSize Int (Modified) Maximum message length.
msgRetentionSeconds Int (Modified) How long the messages will be kept.
rewindSeconds Int (Modified) Maximum rewind time for messages.
## 4. Example

Input:

 https://domain/v2/index.php?Action=SetQueueAttributes
 &queueName=test-queue-123
 &pollingWaitSeconds=20
 &<Common request parameters>

Output:

{
"code" : 0,
"message" : "",
"requestId":"14534664555",
"queueId":"queue-ajksdfasdowe",
"maxMsgHeapNum":10000000,
"pollingWaitSeconds":20,
"visibilityTimeout":0,
"maxMsgSize":65536,
"msgRetentionSeconds":345600
}