Distributed Message Service RocketMQ

Creating a Topic

2024-07-08 08:44:57

API Introduction

Used to create a topic.

API Restrictions

None.

URl

POST https://[endpoint]/v2/topic/create

Request Parameters

Request Parameters

Required or Not

Position

Parameter Type

Description

prodInstId

Yes

body

String

Instance   ID

brokerNameList

Yes

body

List<String>

List of names of brokers for which   topics are created

allowdConsumerGroups

No

body

List<String>


topicName

Yes

body

String

Topic   Name

writeQueueNums

Yes

body

int

A topic property, the number of write   queues. The default value is 16

readQueueNums

Yes

body

int

A topic property,, the number of read   queues. The default value is 16

perm

Yes

body

int

Permissions: 2: write, 4:   read, 6: read/write.

Default value: read/write.

order

Yes

body

String

Whether it is an ordered topic. true:   ordered; false: unordered, defaulting to false

remark

No

body

String

Topic   Remarks

Response Parameter

Response Parameter

Parameter Type

Description

statusCode

String

The   status code of the interface on the system layer. Success: 800; failure: 900.

message

String

Status   Description

returnObj

String

Return   the object. The parameters included in this parameter are described in the   comments in Response Examples.

 

Sample Request

POST https://[endpoint]/v2/topic/create

{

    "prodInstId":"mq_test",

    "brokerNameList":[

        "mq_test_broker_1"

    ],

    "writeQueueNums":4,

    "readQueueNums":4,

    "order":"false",

    "perm":6,

    "allowdConsumerGroups":[

 

    ],

    "topicName":"test1"

}

Examples of a Successful Response

{

    "returnObj":{

 

    },

    "message":"success",

    "statusCode":800

}

Example of a Failed Response

{

    "returnObj": {},

    "message": "...",

    "statusCode": "900"

}


d3qCK8iOc3Xm