public TopicConfig examineTopicConfig()

in src/main/java/org/apache/rocketmq/dashboard/service/client/MQAdminExtImpl.java [176:203]


    public TopicConfig examineTopicConfig(String addr, String topic) throws MQBrokerException {
        TopicConfigSerializeWrapper cachedWrapper = TOPIC_CONFIG_CACHE.get(addr);

        if (cachedWrapper != null && cachedWrapper.getTopicConfigTable().containsKey(topic)) {
            return cachedWrapper.getTopicConfigTable().get(topic);
        }

        RemotingClient remotingClient = MQAdminInstance.threadLocalRemotingClient();
        RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.GET_ALL_TOPIC_CONFIG, null);
        RemotingCommand response = null;
        try {
            response = remotingClient.invokeSync(addr, request, 3000);
        } catch (Exception err) {
            Throwables.throwIfUnchecked(err);
            throw new RuntimeException(err);
        }
        switch (response.getCode()) {
            case ResponseCode.SUCCESS: {
                TopicConfigSerializeWrapper topicConfigSerializeWrapper =
                        decode(response.getBody(), TopicConfigSerializeWrapper.class);

                TOPIC_CONFIG_CACHE.put(addr, topicConfigSerializeWrapper);
                return topicConfigSerializeWrapper.getTopicConfigTable().get(topic);
            }
            default:
                throw new MQBrokerException(response.getCode(), response.getRemark());
        }
    }