Last updated: 2020-06-08 16:02:37


    This is a legacy API which has been hidden and will no longer be updated. We recommend using the new CMQ API 3.0 which is standardized and faster.

    Welcome to Tencent Cloud message queue CMQ (Cloud Message Queue).

    Tencent Cloud message queuing (Cloud Message Queue, (hereinafter referred to as CMQ) is a distributed message queuing service that stores messages transmitted between processes and provides reliable message-based asynchronous communication services between different distributed applications or between different components of an application. Messages are stored in highly reliable and highly available message queues, and multiple processes can read and write at the same time without interfering with each other. With Tencent Cloud CMQ, users can pass information between distributed components executing different job's applications without losing messages or requiring that each component is always available.

    The queue acts as a buffer between the data sender and the data receiver. Queues can solve the problems when the working speed of the data sender is faster than that of the data receiver, or when the data sender or data receiver is only intermittently connected to the network.

    In the traditional process communication mode, the client requests the service of the server and waits for the response of the server. However, this model has many disadvantages: for example, when the network condition is bad, the client's request may be lost; when the server-side processing time is too long, it may cause the client to wait for a long time and the request timed out and failed.

    To this end, Tencent Cloud introduced message queuing service for message distribution and management. With Tencent Cloud CMQ, you can separate the components of an application so that they can run independently, while simplifying message management between components. Any component of a distributed application can store messages in queues, and Tencent Cloud CMQ ensures that each message is delivered at least once and supports multiple reads and writes. A single queue can be used by multiple distributed application components at the same time without the need for collaboration between these components. All components can use CMQ API to retrieve and manipulate messages programmatically.

    For all supported operations, see API Overview Page .

    Please make sure that you have a good understanding of these interfaces before using them. CMQ product description .

    The helper account cannot be used for CMQ operations at this time.

    Queue model

    Glossary of terms

    Below is the list of common terms used in this document:

    Terminology Full name English Description
    CMQ Cloud Message Queue Cloud message queue Tencent Cloud's message service includes queue model, topic model, high-performance message service and so on.
    Queue Queue Queue Queue is a first-in-first-out data model. Producers can add data to the end of the queue by Concurrence, and consumers can pull (pull) data from the head of the queue by Concurrence.
    Active Active Can be consumed (visible) state When the message is in Active state, it can be consumed by all consumers, but only one consumer can successfully consume it. At this time, the message becomes Inactive and is not visible to other consumers.
    Inactive Inactive Non-consumable (invisible) state When a message is in the Inactive state, it indicates that the message is being consumed by a consumer, and other consumers cannot consume the message.
    (Batch) ReceiveMessage (Batch) Receive Message Consumption message The ReceiveMessage operation simply sets the message from the Active state to the Inactive state so that the message cannot be consumed by other consumers. However, after consumption, Explicit has to call the (Batch) DeleteMessage operation to delete the message from the queue, otherwise, after the time specified by visibilityTimeout, the message becomes Active again and can be consumed by other consumers, resulting in unexpected duplicate messages.
    MaxMsgHeapNum Maximum Message Heap Number Maximum number of Message Retention In order to prevent the message from being lost because the message is not consumed in time, the message service has the function of heap message. Heap has an upper limit on the number of messages. Producers can no longer add messages to the queue after the limit is exceeded. After the message is consumed and deleted, the producer can add the message to the queue.
    PollingWaitSeconds Polling Wait Seconds Long-polling Waiting Time for Message Receipt When consumers want to pull messages from the queue for consumption, the queue may have no data for the time being. Consumers may not want to return immediately (similar to non-blocking mode) and want to wait for a period of time to see if a message will come. (similar to blocking mode), pollingWaitSeconds is similar to the timeout in blocking mode. After this time, it will return regardless of whether there is a message or not. If you want to consume messages nonblocking, set the value to 0.
    MsgRetentionSeconds Message Retention Seconds Message Lifecycle Heap's message in the queue has a retention time, after which it has not been consumed by consumers, it will be deleted by the queue, and consumers can no longer consume it.
    ReceiptHandle Receipt Handle Message receipt handle This handle is returned when the message is consumed, and only the handle that is currently consuming the message can delete the message. If the consumption time is too long and exceeds the visibilityTimeout, the message will be consumed by other consumers, and the previous consumer's handle to get the message will become invalid and cannot be used to delete the message.
    Qps throttling QPS Throttling QPS restriction The term originally means a limit on the number of requests per second, but it is actually a limit on the number of messages per second. The number of requests per second for a single interface (SendMessage, ReceiveMessage, DeleteMessage),). But for batch interfaces (BatchSendMessage, BatchReceiveMessage, BatchDeleteMessage),), it is the sum of all batch values within 1 second. The purpose of this restriction is to provide users with a more stable and fair product. If you need a larger message limit, you can Submit a ticket Apply to us.

    Definition of input parameters and return parameters

    • Limit and offset
      Limit and offset are parameters used to control paging. When the corresponding result is in the form of a list, if the number exceeds the value limited by limit, only limit values are returned. Users can control paging through two parameters: limit and offset: limit is the maximum number of entries returned at a time, and offset is the offset.
      For example, the parameter offset=0&limit=20 returns items 0 to 20, offset=20&limit=20 returns items 20 to 40, offset=40&limit=20 returns items 40 to 60, and so on.

    • Id.n
      Id.n is a format in which multiple pa