You need to enable JavaScript to run this app.
文档中心
消息队列 RocketMQ版

消息队列 RocketMQ版

复制全文
下载 pdf
Topic管理
CreateTopicAsync - 异步创建 Topic
复制全文
下载 pdf
CreateTopicAsync - 异步创建 Topic
调用 CreateTopicAsync 接口异步创建 Topic。
调试
API Explorer
您可以通过 API Explorer 在线发起调用,无需关注签名生成过程,快速获取调用结果。
请求参数
下方仅列出该接口特有的请求参数和部分公共参数。更多信息请见公共参数
Action string 必选 示例值:CreateTopicAsync
要执行的操作,取值:CreateTopicAsync。
Version string 必选 示例值:2023-01-01
API的版本,取值:2023-01-01。
QueueNumber integer 必选 示例值:12
设置当前 Topic 的队列数量。
MessageType integer 必选 示例值:0
消息类型。取值说明如下:
  • 0:普通消息
  • 1:事务消息
  • 2:分区顺序消息
  • 3:全局顺序消息
  • 4:延时消息
AccessPolicies object[] 可选 示例值:"AccessPolicies": [ { "AccessKey": "C3OmUvlr6*****dO5m21rOGd", "Authority": "PUB" } ],
每个 RocketMQ 密钥对于当前 Topic 的权限,支持批量设置权限。若未设置,每个密钥对于当前 Topic 维持密钥的默认权限。
AccessKey string 必选 示例值:C3OmUvlr6*****
RocketMQ 密钥的 AccessKey。
Authority string 必选 示例值:PUB
用户对于当前Topic的访问权限。
  • ALL:拥有发布、订阅权限。
  • PUB:拥有发布权限。
  • SUB:拥有订阅权限。
  • DENY:不具备发布或订阅权限。
Description string 可选 示例值:topic-test
创建 Topic 的描述信息。
InstanceId string 必选 示例值:rocketmq-cnai1f0c29ca****
实例 ID。
TopicName string 必选 示例值:my_topic
Topic 的名称。 命名规则如下:
  • 长度为 3~100 个字符。
  • 只能包含英文、数字、连字符(-)以及下划线(_)。
返回参数
本接口无特有的返回参数。更多信息请见返回结构
请求示例
POST /?Action=CreateTopicAsync&Version=2023-01-01 HTTP/1.1
Host: rocketmq.cn-beijing.volcengineapi.com
Content-Type: application/json; charset=UTF-8
X-Date: 20260112T032020Z
X-Content-Sha256: 287e874e******d653b44d21e
Authorization: HMAC-SHA256 Credential=Adfks******wekfwe/20260112/cn-beijing/RocketMQ/request, SignedHeaders=host;x-content-sha256;x-date, Signature=47a7d934ff7b37c03938******cd7b8278a40a1057690c401e92246a0e41085f
{
"QueueNumber": 12,
"MessageType": 0,
"InstanceId": "rocketmq-cnai1f0c29ca****\n",
"TopicName": "my_topic"
}
返回示例
{
"ResponseMetadata": {
"RequestId": "2026011211203500513010907470****",
"Action": "CreateTopicAsync",
"Version": "2023-01-01",
"Service": "RocketMQ",
"Region": "cn-beijing"
},
"Result": {}
}
错误码
下表为您列举了该接口与业务逻辑相关的错误码。公共错误码请参见公共错误码文档。
状态码
错误码
错误信息
说明
400
InvalidParameter
The specified parameter %s is not valid.
参数值%s无效,请检查后重试。
400
InvalidPara
The specified parameter is not valid.
参数值无效。
400
TopicNotExist
The specified topic does not exist.
Topic 不存在。
400
InvalidTopicName.AlreadyExists
The specified topic name already exists.
Topic 名称已存在。
400
QuotaExceeded.QueueNumber
The number of queue exceeds the limit.
队列数量超出上限。
400
QuotaExceeded.TopicNumber
The number of topic exceeds the limit.
Topic 数量超出上限。
400
OperationDenied.InvalidRequest
The request that you specified is not valid.
请求异常,请检查后重试。
403
OperationDenied.ResourceOccupied
The resource is busy now, please try again later.
资源繁忙,可能由于指定资源正在被访问或回收。
404
InvalidInstanceId.NotFound
The specified Instance ID does not exist.
实例不存在。
500
ServerInternalError
The request failed due to some unknown error, exception or failure.
服务内部错误。
503
ServiceUnavailable
The request failed due to a temporary failure of the server.
当前服务暂时不可用。
最近更新时间:2026.02.13 18:31:53
这个页面对您有帮助吗?
有用
有用
无用
无用