Distributed Message Service RocketMQ

Creating Topics and Subscription Groups

2024-07-03 03:18:49

Background

After creating an instance, you need to create a topic and subscription group to manage the daily functions of the message instance.

l   Topics: In RocketMQ, a topic is a logical group of published messages. It is similar to a message classification or label and helps users to classify and manage different types of messages. Typically, a topic contains multiple message producers and consumers. With topics, RocketMQ enables efficient message publish and subscription to help users manage and organize messages more efficiently.

l   A subscription group is an important concept in RocketMQ, used to support the publish and subscribe modes of messages. A subscription group contains multiple consumers that consume messages in the same topic. When a message is sent to a topic, each consumer in the subscription group receives the message according to certain rules to process the message in load balancing mode. A subscription group is a flexible and scalable method in RocketMQ to support the publish and subscribe modes of messages and ensure the balanced distribution and reliable processing of messages among consumers.

l   A RocketMQ cluster is a distributed message middleware system consisting of multiple nodes or brokers. Each node has identical functions and can process and store messages. A RocketMQ cluster enables HA and scalability by distributing messages to different nodes. A RocketMQ cluster realizes the parallel processing, fault tolerance and HA of message transmission, and meets the message transmission requirements in high concurrency scenarios.

Creating a 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.

l   Batch Create

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.

l   Topic Template

You must use the template to batch upload topics successfully.

 Creating a Subscription Group

1.      Go to the subscription management menu and click Create. 

2.         Fill in the corresponding fields in the pop-up window.

(1) The current cluster name is displayed by default and cannot be changed.

(2) Enter the subscription group name. A name contains 2 to 64 characters and will fail to be created if it exceeds the length limit. The name of a user-created subscription group can only consist of uppercase and lowercase letters, numbers, underscores (_) and hyphens (-).

(3) Fill in the topic remarks as required.

(4) Select the broker where the subscription group 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.

(5) Select whether to enable consumption, which is enabled by default.

3.         After entering the subscription group information, save and confirm it. A subscription group is created.

4.         To create subscription groups in batch, click Batch Create.

l   Bulk Creation

Note: The subscription group name that you have entered should not contain special characters such as spaces.

Batch create subscription groups by uploading the CSV format template. Format: Click Subscription Group Template for download.

l   Subscription Group Template

You must use the template to batch upload subscription groups successfully.


eI9PnT0WXAxl