All Products
Search
Document Center

OnsTopicCreate

Last Updated: Apr 26, 2019

OnsTopicCreate

You can call this operation to create a topic.

Description

This operation is called when new topics are required to publish new applications or implement service logic.

By default, only primary accounts can call this operation. RAM sub-accounts can call this operation only after being authorized.

The following table lists request parameters:

Name Type Required Description
PreventCache Long Yes The parameter used for CSRF verification, which can be set to the current system time. Unit: ms
InstanceId String No The ID of the instance.
Topic String Yes The name of the topic you want to create.
Note:
  • “CID” and “GID” are the reserved fields of a group ID, and they cannot be the start of a topic name.
  • If namespaces are available in the instance for which the topic is created, the topic name must be unique in the instance and can be duplicated across instances.
  • If no namespaces are available in the instance, the topic name must be unique both in the instance and across instances.
MessageType Integer Yes The type of the message. Valid values:
  • 0: normal message
  • 1: partitionally ordered message
  • 2: globally ordered message
  • 4: transactional message
  • 5: scheduled/delayed message
Remark String No The remarks on the request. This parameter can be left blank.

Response parameters

Name Type Description
RequestId String A common parameter. Each request has a unique ID to facilitate troubleshooting and fault locating.
HelpUrl String A help link.

Examples

For more information about sample codes, see API sample code and endpoints.