Pirate-Captain edited a comment on issue #3179:
URL: https://github.com/apache/rocketmq/issues/3179#issuecomment-888058959


   @lizhiboo @guyinyou 
   As all of the brokers set the autoCreateTopicEnable false, So I just change 
the method "updateTopicRouteInfoFromNameServer" as follow(MQClientInstance line 
358), instead of changing the log level of 'RocketmqClient' to 'ERROR':
   ```java
           for ( String topic : topicList ) {
               if ( StringUtils.equals(topic, 
TopicValidator.AUTO_CREATE_TOPIC_KEY_TOPIC) ) {
                   continue;
               }
               this.updateTopicRouteInfoFromNameServer(topic);
           }
   ```
   Suggestion 1:
   In my opinion, it is no necessary to update the TBW102 topic route info 
here. If the autoCreateTopicEnable set true, when send message, if the topic is 
not exist, it will update TBW102 topic route info 
first(DefaultMQProducerImpl.sendDefaultImpl() line 566).
   
   Suggestion 2(I haven't tested this method ):
   Change the constructor of TopicConfigManager, Just put the TBW102 to the 
topicConfigTable, then when broker start, it will regist the TBW102 to the 
nameserver.
   If the autoCreateTopicEnable set false, if the topic is not exist, when the 
message send to the broker, it will invoke the method of 
TopicConfigManager.createTopicInSendMessageMethod, this method will check if 
the defaultTopic is TBW102 and the autoCreateTopicEnable is 
true(TopicConfigManager line 170), if the autoCreateTopicEnable is false, it 
will return null topicConfig. It won't auto create topic either.  I just read 
the code, and never try this method.


-- 
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