leizhiyuan commented on issue #7830:
URL: https://github.com/apache/rocketmq/issues/7830#issuecomment-1951971926

   ```
   public TopicRouteData getTopicRouteInfoFromNameServer(final String topic, 
final long timeoutMillis,
           boolean allowTopicNotExist) throws MQClientException, 
InterruptedException, RemotingTimeoutException, RemotingSendRequestException, 
RemotingConnectException {
           GetRouteInfoRequestHeader requestHeader = new 
GetRouteInfoRequestHeader();
           requestHeader.setTopic(topic);
           RemotingCommand request = 
RemotingCommand.createRequestCommand(RequestCode.GET_ROUTEINFO_BY_TOPIC, 
requestHeader);
   
           RemotingCommand response = this.remotingClient.invokeSync(null, 
request, timeoutMillis);
           assert response != null;
           switch (response.getCode()) {
               case ResponseCode.TOPIC_NOT_EXIST: {
                   if (allowTopicNotExist) {
                       log.warn("get Topic [{}] RouteInfoFromNameServer is not 
exist value", topic);
                   }
   
                   break;
               }
               case ResponseCode.SUCCESS: {
                   byte[] body = response.getBody();
                   if (body != null) {
                       return TopicRouteData.decode(body, TopicRouteData.class);
                   }
               }
               default:
                   break;
           }
   
           throw new MQClientException(response.getCode(), 
response.getRemark());
       }
   
   ```
   
   if allowTopicNotExist is true, maybe we shoud not throw 
   
           throw new MQClientException(response.getCode(), 
response.getRemark());
   


-- 
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: commits-unsubscr...@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to