Scenario
A RocketMQ topic is a logical classification unit of messages, and is used to group and manage messages. The following shows some common scenarios where you need to create a topic based on specific business needs:
l Message publish/subscribe: You can create a topic to manage the associated messages in publish/subscribe mode. Publishers can send messages to the topic, which can be subscribed to by subscribers to receive messages.
l Event-driven architecture: In the architecture, different modules communicate with each other through events. Each event corresponds to a topic and is sent to the corresponding topic through a module. Other modules can subscribe to the topic to receive event notifications.
l Log collection and analysis: To collect and analyze a large amount of log data, you can create a topic to manage log messages. Log producers can send log messages to this topic, which can be subscribed to by log consumers to analyze or store data.
l Asynchronous processing: To process certain operations asynchronously, you can create a topic to manage the associated asynchronous messages. The operation initiator can send asynchronous messages to this topic, which can be subscribed to by asynchronous processors for follow-up processing.
l Distributed transaction message: In a distributed system, you can create a topic to manage the associated transaction messages. Transaction initiators can send transaction messages to this topic, which can be subscribed to by transaction consumers to process and verify transactions.
To sum up, you can create a topic based on specific business needs. Topics logically classify and manage messages to support different messaging modes and business scenarios.
New Topic
1. On the eSurfing Cloud official website, click Control Center and select RocketMQ.
2. Log in to the DMS RocketMQ console and click Region in the upper right corner to select the corresponding resource pool.
3. Go to the instance list and click Manage to enter the management menu.
4. Go to the topic management menu and click Create Topic.
5. On the pop-up page, fill in the following field information:
(1) The current cluster name is displayed by default and cannot be changed.
(2) Select the broker where the topic is located and list each broker based on the number of the master-slave node pairs that you have selected when creating an instance, which can be checked.
(3) Fill in the topic name. A name contains 2 to 64 characters and will fail to be created if it exceeds the length limit. A user-created topic can only consist of uppercase and lowercase letters, numbers, underscores (_) and hyphens (-).
(4) Fill in the topic remarks as required.
(5) Fill in the number of broker partitions. The number of partitions must be greater than 0 and less than or equal to 8, When creating a strictly ordered queue, set the number of partitions to 1 and only one broker can be selected.
(6) Choose a production mode. RocketMQ is an open-source distributed message middleware that supports two message production modes, namely, ordered and unordered messages.
l Ordered Message: Messages are sent to the same message queue according to certain rules, and are consumed in the same order on the consumer. This mode applies to scenarios that require a strict message sequence, such as order processing and process approval.
l Unordered Message: Messages are sent to different and independent message queues. Consumers can consume messages from multiple queues concurrently without regard to the order of the messages. This mode applies to scenarios that do not require strict message sequence, such as log collection and asynchronous notification.
RocketMQ provides the highly reliable message transmission and storage, and supports scale-out and high throughput for both ordered or unordered message productions. Based on specific business needs, you can choose a suitable message production mode better catering to the application requirements.
(7) Select the read-write permissions for the topic. Supported permissions: read-write, read-only, and write-only.
6. After entering the topic information, save and confirm it. A topic is created.
7. To create topics in batch, click Batch Create.
Bulk Creation
Note: The topic name that you entered should not contain special characters such as spaces.
Batch create topics by uploading the CSV file. Format: Click Topic Template for download.
Topic Template
You must use the template to batch upload topics successfully.