tencent cloud

Feedback

Batch Sending Messages

Last updated: 2024-01-03 10:20:36

    API Description

    This API is used to batch send up to 16 messages to a specified queue.
    The public/private domain names for API requests can be copied from Queue Service > API Request Address in the TDMQ for CMQ console. A sample address is as follows:
    Public network address: https://cmq-gz.publicXXX.tencenttdmq.com
    Private network address: http://gz.mqadapter.cmq.tencentyun.com
    Note:
    The API call URL varies by region.
    Whenever downstream traffic is generated from using the public domain name, traffic fees will be charged (even during the beta test period). Therefore, we strongly recommend you use the private domain name to avoid traffic fees.

    Input Parameters

    The list below contains only the API request parameters. Other parameters can be found in Common Request Parameters.
    Parameter
    Required
    Type
    Description
    queueName
    Yes
    String
    Queue name, which must be unique under the same account in the same region. It can contain up to 64 letters, digits, and hyphens and must begin with a letter.
    msgBody.n
    Yes
    String
    Message body, which represents a message in the batch. Currently, a batch can contain up to 16 messages.
    For ease of use, n can start from either 0 or 1, but the values must be consecutive. For example, two messages to be sent can be represented by msgBody.0, msgBody.1 or msgBody.1, msgBody.2.
    Note: As the total size of all messages (msgBody only, excluding message headers and other parameters) cannot exceed 64 KB, we recommend you plan the number of messages to be sent in advance.
    delaySeconds
    No
    Int
    This field indicates how many seconds it should take for the messages to be visible after they are sent to the queue (this delay will take effect for a batch of messages, while many-to-many mapping is not supported).

    Output Parameters

    Parameter
    Type
    Description
    code
    Int
    0: Success. others: Error. For more information, see Common Error Codes.
    message
    String
    Error message.
    requestId
    String
    Request ID generated by the server, which can be submitted to the backend for troubleshooting when an internal server error occurs.
    msgList
    Array
    List of unique IDs of the messages generated by the server. Each element indicates the information of one message.
    msgList is defined as follows:
    Parameter
    Type
    Description
    msgId
    String
    Unique ID of the message generated by the server.

    Error Codes

    For more information, see Common Error Codes.

    Samples

    Input:
    https://domain/v2/index.php?Action=BatchSendMessage
    &queueName=test-queue-123
    &msgBody.1=helloworld1
    &msgBody.2=helloworld2
    &<<a href="">Common request parameters</a>>
    Output:
    {
    "code" : 0,
    "message" : "",
    "requestId":"14534664555",
    "msgList":
    [
    {
    "msgId":"123345346"
    },
    {
    "msgId":"456436346"
    }
    ]
    }
    
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support