Updated on 2022-02-21 GMT+08:00

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

Table 1 Parameter description

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.

Table 2 Parameter description of messages

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"
   }
]