mattisonchao opened a new issue #13794:
URL: https://github.com/apache/pulsar/issues/13794


   ## 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
   
   > SystemTopicNameManager
   
   ```java
   
   package org.apache.pulsar.broker.service;
   
   public interface SystemTopicNameManager {
   
       // The default is full quality topicName
       void register(TopicName topicName);
   
       // judgement this topic name if is a system topic
       boolean isSystemTopic(TopicName topicName);
   
   }
   ```
   This manager can be used for dynamic registration.
   
   ## Reject Alternatives
   
   none.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to