Message Production API
Function
This API is used to send messages to a queue. Multiple messages can be sent at a time. The following requirements must be met:
- A maximum of 10 messages can be sent at a time.
- The aggregated size of messages sent at a time cannot exceed 2 MB.
- The endpoint is https://{rest_connect_address}:9292. You can query the value of rest_connect_address through a specified instance interface.
URI
POST /v1/topic/{topic_name}/messages
Parameter |
Type |
Mandatory |
Description |
---|---|---|---|
topic_name |
String |
Yes |
Topic name. |
Request
Request parameter
Parameter |
Type |
Mandatory |
Description |
---|---|---|---|
messages |
Array |
Yes |
Message list. The array size cannot exceed 10 and cannot be null. |
Parameter |
Type |
Mandatory |
Description |
---|---|---|---|
content |
Object |
Yes |
Message content. |
id |
String |
Yes |
Message sequence number, which must be unique. |
Example request
{ "messages": [ { "content": "hello roma-1", "id": "1" }, { "content": "hello roma-2", "id": "2" }, { "content": "hello roma-3", "id": "3" } ] }
Response
Response parameter
Parameter |
Type |
Description |
---|---|---|
state |
String |
Result status. The value can be success or fail. |
id |
String |
Message sequence number. |
Example response
[ { "state": "success", "id": "1" }, { "state": "success", "id": "2" }, { "state": "success", "id": "3" } ]
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot