Reviewed-by: Ziuzko, Stanislav <stanislav.ziuzko@t-systems.com> Co-authored-by: chenjunjie <chenjunjie@huawei.com> Co-committed-by: chenjunjie <chenjunjie@huawei.com>
15 KiB
Sending Messages
Function
This API is used to send messages.
URI
POST /v2/{project_id}/rocketmq/instances/{instance_id}/messages
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
project_id |
Yes |
String |
Definition Project ID. For details about how to obtain it, see Obtaining a Project ID. Constraints N/A Range N/A Default Value N/A |
instance_id |
Yes |
String |
Definition Instance ID. You can call the API for querying all instances to obtain the instance ID. The instance ID is in the response body. Constraints N/A Range N/A Default Value N/A |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
topic |
Yes |
String |
Definition Topic name. Constraints N/A Range N/A Default Value N/A |
body |
Yes |
String |
Definition Message content. Constraints N/A Range N/A Default Value N/A |
property_list |
No |
Array of SendMessageProperties objects |
Definition Feature list. Constraints N/A Range N/A Default Value N/A |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
|---|---|---|
topic |
String |
Definition Topic name. Constraints N/A Range N/A Default Value N/A |
body |
String |
Definition Message content. Constraints N/A Range N/A Default Value N/A |
property_list |
Array of SendMessageProperties objects |
Definition Feature list. Constraints N/A Range N/A Default Value N/A |
msg_id |
String |
Definition Message ID. Constraints N/A Range N/A Default Value N/A |
queue_id |
Number |
Definition Queue ID. Constraints N/A Range N/A Default Value N/A |
queue_offset |
Number |
Definition Queue offset. Constraints N/A Range N/A Default Value N/A |
broker_name |
String |
Definition Broker name. Constraints N/A Range N/A Default Value N/A |
Example Requests
Sending messages
POST https://{endpoint}/v2/{project_id}/rocketmq/instances/{instance_id}/messages?topic={topic}
{
"topic" : "aaaaaaaaaaaa",
"body" : "test",
"property_list" : [ ]
}
Example Responses
Status code: 200
Queried.
{
"topic" : "aaaaaaaaaaaa",
"body" : "test",
"property_list" : [ ],
"msg_id" : "644F0E2A315323EAB33D8F4733110009",
"queue_id" : 0,
"queue_offset" : 0,
"broker_name" : "broker-0"
}
Status Codes
Status Code |
Description |
|---|---|
200 |
Queried. |
Error Codes
See Error Codes.