tencent cloud

All product documents
TDMQ for Apache Pulsar
Automatically create Topic
Last updated: 2025-04-01 14:14:42
Automatically create Topic
Last updated: 2025-04-01 14:14:42
This documentation introduces the usage method and common issues of automatically creating a Topic.

Prerequisites

1. This feature depends on the data plane version. If your cluster was created before January 18, 2025, this feature is not supported. If you need to upgrade the version, contact us.
2. Use a professional cluster.
3. Cluster-level, enable automatic creation of topics.

Usage Method

1. When using the automated Topic creation feature, pay attention to standardizing Topic naming:
Topic name length should be controlled within 128 characters;
Topic name content should be within valid characters (alphanumeric characters as well as symbols -_=:.);
Topic name cannot contain the string "-partition-".
2. When using the automated Topic creation feature, only persistent partitioned topics can be created.
3. Avoid creating a persistent Topic and a non-persistent Topic with the same name:
If you create a non-persistent topic (non-persistent://tenant/namespcaec/topic1) through the console and then auto-create a persistent topic (persistent://tenant/namespce/topic1), the persistent topic topic1 will not be shown in the console and will impact monitoring data reporting.
If this issue occurs, you can delete the non-persistent topic topic1 in the console, and after refreshing the page, synchronize data to display the persistent topic topic1.
4. When using the retry queue and dead letter queue and enabling the automatic creation Topic feature:
- If a user does not configure the parameters retryLetterTopic and deadLetterTopic in deadLetterPolicy when constructing consumer logic, a retry queue topic named "subscription name-RETRY" and a dead letter queue topic named "subscription name-DLQ" will be automatically created to send and receive messages. This will differ from the retry queue topic and dead letter queue topic created by enabling this feature in the console.
Secondly, it is necessary to pay additional attention. If an existing user has not configured a complete deadLetterPolicy and the client version is low, after restarting the consumer, messages will be sent and consumed to and from the retry queue (named "subscription name-RETRY") and the dead letter queue (named "subscription name-DLQ"). The previously used retry queue (named "topic name-subscription name-RETRY") and dead letter queue (named "topic name-subscription name-DLQ") will become invalid, resulting in message loss issues.
To avoid the above issues, it is recommended to set the retry topic and dead letter topic in deadLetterPolicy when creating a consumer:
Consumer<byte[]> consumer = myClient.newConsumer()
.topic("persistent://wzjtest-tenant/test-ns/topic1")
.subscriptionName("sub")
.enableRetry(true)
.subscriptionType(SubscriptionType.Shared)
.deadLetterPolicy(DeadLetterPolicy.builder().maxRedeliverCount(1) // Complete configuration
.retryLetterTopic("topic1-sub-RETRY") // Naming specification: topic name-subscription name-RETRY
.deadLetterTopic("topic1-sub-DLQ") // Naming specification: topic name-subscription name-DLQ
.build())
.subscribe();
Java client versions 3.0.6, 3.3.1, or 4.0.0 and higher can avoid this issue by optimizing the automatic creation of the retry queue (named "subscription name-RETRY") and the dead letter queue (named "subscription name-DLQ"), but it is still recommended that users explicitly configure the complete retry topic and dead letter topic parameter information in the deadLetterPolicy. The current existing version of the Go client does not currently support avoiding this issue.
5. There is a limit to the number of topics and partitions for different cluster specifications
For using the automatic topic creation feature, control the appropriate number of topics.
If the specification that exceeds the limit of the number of cluster topics is used, topics can no longer be successfully created, and an error "Topic Not Found." will be reported.

Common Issues

During the process of using the automatic topic creation feature, if the error information "Topic Not Found." occurs, please troubleshoot according to the following reasons:
This topic is a non-persistent topic.
The name of this topic contains the string "-partition-".
The name of this topic exceeds the maximum length limit (128 characters).
The current number of created topics has reached the maximum topic number limit of the current cluster specification.
The name of this topic contains characters other than the supported characters (alphanumeric characters as well as symbols "-_=:.") of the topic name.
The name of this topic does not match the three-segment naming standard (three-segment naming standard: persistent://tenantName/namespacesName/topicName).

Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback

Contact Us

Contact our sales team or business advisors to help your business.

Technical Support

Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

7x24 Phone Support
Hong Kong, China
+852 800 906 020 (Toll Free)
United States
+1 844 606 0804 (Toll Free)
United Kingdom
+44 808 196 4551 (Toll Free)
Canada
+1 888 605 7930 (Toll Free)
Australia
+61 1300 986 386 (Toll Free)
EdgeOne hotline
+852 300 80699
More local hotlines coming soon