All Products
Search
Document Center

ApsaraMQ for RocketMQ:OnsTopicCreate

Last Updated:Mar 03, 2024

Creates a topic.

Operation description

Note API operations provided by Alibaba Cloud are used to manage and query resources of Alibaba Cloud services. We recommend that you integrate these API operations only in management systems. Do not use these API operations in the core system of messaging services. Otherwise, system risks may occur.

When you want to release a new application or expand your business, you can call this operation to create a topic based on your business requirements.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
mq:CreateTopicWrite
  • All Resources
    *
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
TopicstringYes

The name of the topic that you want to create. The name must meet the following rules:

  • The name must be 3 to 64 characters in length and can contain letters, digits, hyphens (-), and underscores (_).
  • The topic name cannot start with CID or GID because CID and GID are reserved prefixes for group IDs.
  • If the ApsaraMQ for RocketMQ instance in which you want to create the topic uses a namespace, the topic name must be unique in the instance. The topic name cannot be the same as an existing topic name or a group ID in the instance. The topic name can be the same as a topic name or a group ID in another instance that uses a different namespace. For example, if Instance A and Instance B use different namespaces, a topic name in Instance A can be the same as a topic name or a group ID in Instance B.
  • If the instance in which you want to create the topic does not use a namespace, the topic name must be globally unique across instances and regions. The topic name cannot be the same as an existing topic name or group ID in all ApsaraMQ for RocketMQ instances that belong to your Alibaba Cloud account.
Note To check whether an instance uses a namespace, log on to the ApsaraMQ for RocketMQ console, go to the Instance Details page, and then view the value of the Namespace field in the Basic Information section.
test
MessageTypeintegerYes

The type of messages that you want to publish to the topic. Valid values:

  • 0: normal messages
  • 1: partitionally ordered messages
  • 2: globally ordered messages
  • 4: transactional messages
  • 5: scheduled or delayed messages

For more information about message types, see Message types.

0
RemarkstringNo

The description of the topic that you want to create.

Test
InstanceIdstringYes

The ID of the instance in which you want to create the topic.

MQ_INST_188077086902****_BXSuW61e

Response parameters

ParameterTypeDescriptionExample
object

The data returned.

RequestIdstring

The ID of the request. This parameter is a common parameter. Each request has a unique ID. You can use this ID to troubleshoot issues.

B6949B58-223E-4B75-B4FE-7797C15E****

Examples

Sample success responses

JSONformat

{
  "RequestId": "B6949B58-223E-4B75-B4FE-7797C15E****"
}

Error codes

HTTP status codeError codeError message
400%s%s, please check and retry later

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
No change history

Create a topic in the console

You can also create a topic in the ApsaraMQ for RocketMQ console.**** For more information, see Manage topics.