Original issue : https://github.com/apache/pulsar/issues/13794 Original pull request : https://github.com/apache/pulsar/pull/13813
Pasted below for quoting convenience. ----------- ## Motivation - The current system topic names are scattered and difficult to maintain and dynamically configure. See SystemTopicClient.class 193 line. ```java public interface SystemTopicClient<T> { // omit some code static boolean isSystemTopic(TopicName topicName) { if (topicName.getNamespaceObject().equals(NamespaceName.SYSTEM_NAMESPACE)) { return true; } TopicName nonePartitionedTopicName = TopicName.get(topicName.getPartitionedTopicName()); // event topic if (EventsTopicNames.checkTopicIsEventsNames(nonePartitionedTopicName)) { return true; } String localName = nonePartitionedTopicName.getLocalName(); // transaction pending ack topic if (StringUtils.endsWith(localName, MLPendingAckStore.PENDING_ACK_STORE_SUFFIX)) { return true; } // health check topic if (StringUtils.endsWith(localName, BrokersBase.HEALTH_CHECK_TOPIC_SUFFIX)){ return true; } return false; } } ``` Every time a SystemTopic is added, it must be defined here. - Some **Apache Pulsar** extensions such as ``Protocol Handler`` cannot create namespace-level SystemTopic. ## Goal Add ``SystemTopicNameManager`` to manage all system topic names. And can accept dynamic registration. ## API Changes none. ## Implementation > SystemTopicNamePolicy ```java public enum SystemTopicNamePolicy { PREFIX, SUFFIX, FULL_QUALITY } ``` We can support multiple system topic matching modes, such as **prefix,suffix,full-quality.** > SystemTopicNameManager ```java @Slf4j public class SystemTopicNameManager { public static void register(TopicName topicName) public static void register(String topicName) public static void register(String topicName, SystemTopicNamePolicy systemTopicNamePolicy) public static boolean isSystemTopic(TopicName topicName) } ``` The manager can be used for dynamic registration to determine whether the topic name is a system topic. ## Reject Alternatives none.