The parameters in the following example are for reference only and are actually based on the values returned by the system. For ease of illustration, operations on messages take a single operation as an example, batch interfaces such as Send messages in batch 、 Bulk delete messages Etc.) is also available.
https://cmq-queue-{$region}.api.qcloud.com
http://cmq-queue-{$region}.api.tencentyun.com
{$region} need to replace: gz (Guangzhou), sh (Shanghai), bj (Beijing), shjr (Shanghai Finance), szjr (Shenzhen Finance), hk (Hong Kong), cd (Chengdu), ca (North American), usw (Maxi), sg (Singapore with a specific region. The region value in the common parameters should be consistent with the region value of the domain name. If there is any inconsistency, the request will be sent to the region specified by the domain name region based on the region value of the domain name.
cmq-queue-{$region}.api.tencentyun.com/v2/index.php
The {$region} field needs to be replaced by a specific region:: gz (Guangzhou), sh (Shanghai), bj (Beijing), shjr (Shanghai Finance), szjr (Shenzhen Finance), hk (Hong Kong), cd (Chengdu), ca (North American), usw (Maxi), sg (Singapore). Common Parameters The region value in should be consistent with the region value of the domain name. If there is any inconsistency, the request will be sent to the region specified by the domain name region based on the region value of the domain name.
For more information on the generation rules of Signature parameters, please see Signature Method .Parameter name | Description | Sample value |
QueueName | The queue name must be unique under the same account in a single region. The queue name is a string of no more than 64 characters, must begin with a letter, and the rest can contain letters, numbers, and dashes (-). | Test-queue-1 |
PollingWaitSeconds | Long-polling Waiting Time for Message Receipt . The value range is 0-30 seconds, and the default value is 0. | thirty |
http://cmq-queue-gz.api.tencentyun.com/v2/index.php?Action=CreateQueue&Region=gz&Timestamp=1465750149&Nonce=46364&SecretId=AKIDxxxxugEY&Signature=5umi9gUWpTTyk18V2g%2FYi56hqls%3D&queueName=test-queue-1&pollingWaitSeconds=30
{"code" : 0,"message" : "","requestId":"14534664555","queueId":"queue-ajksdfasdowe"}
test-queue-1
Send a message in the queue. The specific request parameters required are shown in the following table:Parameter name | Description | Sample value |
QueueName | The queue name must be unique under the same account in a single region. The queue name is a string of no more than 64 characters, must begin with a letter, and the rest can contain letters, numbers, and dashes (-). | Test-queue-1 |
MsgBody | Message body. The size is at least 1Byte, and the maximum length is limited by the set queue message maximum length attribute. | After This'is test message (url coding, it becomes This%27is+test+message ) |
http://cmq-queue-gz.api.tencentyun.com/v2/index.php?Action=SendMessage&Region=gz&Timestamp=1465750149&Nonce=46365&SecretId=AKIDxxxxugEY&Signature=5umi9gUWagTTyk18V2g%2FYi56hqls%3D&queueName=test-queue-1&msgBody=This%27is+test+message
{"code" : 0,"message" : "","requestId":"145346456555","msgId":"123345346"}
test-queue-1
Messages are consumed in the queue. The specific request parameters required are shown in the following table:Parameter name | Description | Sample value |
QueueName | The queue name must be unique under the same account in a single region. The queue name is a string of no more than 64 characters, must begin with a letter, and the rest can contain letters, numbers, and dashes (-). | Test-queue-1 |
PollingWaitSeconds | The long polling waiting time for this request. The value range is 0-30 seconds, and the default value is 0. | 10 |
http://cmq-queue-gz.api.tencentyun.com/v2/index.php?Action=ReceiveMessage&Region=gz&Timestamp=1465750150&Nonce=46368&SecretId=AKIDxxxxugEY&Signature=5umi9gUaagTTyk18V2g%2FYi56hqls%3D&queueName=test-queue-1&pollingWaitSeconds=10
{"code" : 0,"message" : "","requestId":"145346635355","msgBody":"This is test message","msgId":"123345346","receiptHandle": "283748239349283","enqueueTime": 1462351990,"firstDequeueTime": 1462352990,"nextVisibleTime": 1462352999,"dequeueCount": 1}
test-queue-1
A message in the queue and delete it after consumption. Be sure to delete before the time of nextVisibleTime Otherwise, the receiptHandle will become invalid, causing the deletion to fail. The specific request parameters required are shown in the following table:Parameter name | Description | Sample value |
QueueName | The queue name must be unique under the same account in a single region. The queue name is a string of no more than 64 characters, must begin with a letter, and the rest can contain letters, numbers, and dashes (-). | Test-queue-1 |
ReceiptHandle | Each consumption returns a unique Message Handler, which is used to delete messages. The handle generated when and only when the message was last consumed can be used to delete this message. | "283748239349283" (receiptHandle in the example above) |
http://cmq-queue-gz.api.tencentyun.com/v2/index.php?Action=DeleteMessage&Region=gz&Timestamp=1465750151&Nonce=46369&SecretId=AKIDxxxxugEY&Signature=5umi9gUaagTasdfk18V2g%2FYi56hqls%3D&queueName=test-queue-1&receiptHandle=283748239349283
{"code" : 0,"message" : "","requestId":"14534454555"}
Parameter name | Description | Value |
QueueName | The queue name must be unique under the same account in a single region. The queue name is a string of no more than 64 characters, the first character must be a letter, and the rest can contain letters, numbers, and dashes (-). | Test-queue-1 |
http://cmq-queue-gz.api.tencentyun.com/v2/index.php?Action=DeleteQueue&Region=gz&Timestamp=1465750152&Nonce=46370&SecretId=AKIDxxxxugEY&Signature=5umi9gUaagTasasdl18V2g%2FYi56hqls%3D&queueName=test-queue-1
{"code" : 0,"message" : "","requestId":"14534454555"}
本页内容是否解决了您的问题?