Topic is a core concept in TDMQ for Pulsar. It is usually used to categorize and manage various messages produced by the system in a centralized manner; for example, messages related to transactions can be placed in a topic named "trade" for other consumers to subscribe to.
In actual application scenarios, a topic often represents a business category. You can decide how to design different topics based on your system and data architectures.
This document describes how to use topics to categorize and manage messages in TDMQ for Pulsar.
You have created a namespace.
Creating a topic
2. On the topic management page, click Create to pop up the Create Topic window.
3. In the Create Topic window, enter the following information:
Topic Name: This field is required and can contain up to 128 digits, letters, and symbols "-\\_=:.".
Topic Type: Persistent or Non-persistent.
Persistent: Persistently stored messages are stored in the disk with multiple replicas to avoid message loss. Such messages are suitable for scenarios that require high data reliability such as financial or business transactions.
Non-persistent: Non-persistently stored messages are directly delivered to an online subscriber and will be deleted upon successful delivery. They will be directly deleted if there are no online subscribers. Such messages are suitable for stream processing or other scenarios that do not require high data reliability. They can only be sent and received as general messages and don’t support features such as query, tracing, delaying, filtering, and rewinding.
For a non-persistent topic, enter a complete topic name prefixed with
Pulsar guarantees that messages in a single partition are sequential. If there is only one partition in a topic, messages are globally sequential there.
Multi-partition topics have better performance than single-partition topics. To balance performance and sequence, you can use the Key-Shared subscription mode as instructed in Subscription Mode to make messages partitionally sequential. You only need to mark messages that need to be sequential with the same key and deliver them to the same partition.
Description: Enter the topic descriptions of up to 128 characters.
4. Click Save, and you can see the created topic in the topic list.
The topic name in the format of
The message type, including general, globally sequential, and partitionally sequential. For more information, see Message Type.
User or **System
The number of topic partitions
Producer: It displays the number of producers/the maximum number of producers. Click it to enter the producer details page. For more information, see Producer Management.
Consumer: It displays the number of consumers/the maximum number of consumers. Click it to enter the consumer details page. For more information, see Subscription Management.
When the value is displayed in orange (warning), the fraction has reached 80%. When it is displayed in red (error), the fraction has reached 90%, in which case you need to close unnecessary client connections.
The creation time of the topic
The topic descriptions
Querying a topic
You can search for topics by topic name in the search box in the top-right corner of the Topic page. TDMQ for Pulsar will perform a fuzzy match and display the search results.
You can also filter topics by Type and Creator in the topic list.
Editing a topic
1. On the Topic page, click Edit in the Operation column of the target topic.
2. In the pop-up window, you can edit the number of topic partitions (which is 1 for globally sequential messages and cannot be modified) as well as the description.
3. Click Submit to complete your edits.
Sending a message
You can manually send a message to the specified topic in the TDMQ for Pulsar console.
1. On the Topic, click Send Message in the Operation column of the target topic. 2. In the pop-up dialog box, enter the message content. The message size is up to 64 KB.
3. Click Submit to send the message. After the message is sent, it can be consumed by any subscribers to the topic.
Adding a subscription
You can manually create a subscription in the TDMQ for Pulsar console.
1. On the Topic page, click Add Subscription in the Operation column of the target topic.
2. Enter the subscription name and description in the pop-up window.
Subscription Name: It can contain up to 64 characters.
Auto-Create Retry & Dead Letter Queue: You can choose whether to automatically create a retry letter topic and a dead letter topic.
Description: Enter descriptions of up to 200 characters.
3. Click Save to complete the creation.
You can click View Subscription in the Operation column of a topic to view its subscriptions, and the subscription just created will be displayed in the list.
If you select Auto-Create Retry & Dead Letter Queue, TDMQ for Pulsar will automatically create a retry topic and a dead letter topic, which will be displayed in the topic list as two new topics named "subscription name + RETRY" and "subscription name + DLQ", respectively.
Deleting a topic
After a topic is deleted, all unconsumed messages retained in it will be cleared; therefore, proceed with caution.
1. On the Topic page, click More > Delete in the Operation column of the target topic. You can also select multiple topics and click Delete at the top of the topic list.
2. In the pop-up window, click Delete.
Force Deletion: After this option is enabled, a topic will be forcibly deleted even if it has subscriptions. Its subscriptions will also be deleted.