public StringBuilder adminQueryClusterTopicView(HttpServletRequest req,
            StringBuilder sBuffer,
            ProcessResult result) {
        // check and get brokerId field
        if (!WebParameterUtils.getIntParamValue(req,
                WebFieldDef.COMPSBROKERID, false, sBuffer, result)) {
            WebParameterUtils.buildFailResult(sBuffer, result.getErrMsg());
            return sBuffer;
        }
        Set<Integer> brokerIds = (Set<Integer>) result.getRetData();
        // check and get topicName field
        if (!WebParameterUtils.getStringParamValue(req,
                WebFieldDef.COMPSTOPICNAME, false, null, sBuffer, result)) {
            WebParameterUtils.buildFailResult(sBuffer, result.getErrMsg());
            return sBuffer;
        }
        Set<String> topicNameSet = (Set<String>) result.getRetData();
        // query topic configure info
        Map<String, List<TopicDeployEntity>> topicConfMap =
                defMetaDataService.getTopicConfMapByTopicAndBrokerIds(topicNameSet, brokerIds);
        BrokerRunManager brokerRunManager = master.getBrokerRunManager();
        int totalCount = 0;
        int brokerCount = 0;
        int totalCfgNumPartCount = 0;
        int totalRunNumPartCount = 0;
        int totalCfgTopicStoreCount = 0;
        int totalRunTopicStoreCount = 0;
        boolean isSrvAcceptPublish = false;
        boolean isSrvAcceptSubscribe = false;
        boolean enableAuthControl = false;
        TopicPropGroup topicProps;
        TopicCtrlEntity authEntity;
        BrokerConfEntity brokerConfEntity;
        Tuple3<Boolean, Boolean, TopicInfo> topicInfoTuple = new Tuple3<>();
        WebParameterUtils.buildSuccessWithDataRetBegin(sBuffer);
        for (Map.Entry<String, List<TopicDeployEntity>> entry : topicConfMap.entrySet()) {
            if (totalCount++ > 0) {
                sBuffer.append(",");
            }
            brokerCount = 0;
            totalCfgTopicStoreCount = 0;
            totalRunTopicStoreCount = 0;
            totalCfgNumPartCount = 0;
            totalRunNumPartCount = 0;
            isSrvAcceptPublish = false;
            isSrvAcceptSubscribe = false;
            enableAuthControl = false;
            for (TopicDeployEntity entity : entry.getValue()) {
                brokerConfEntity =
                        defMetaDataService.getBrokerConfByBrokerId(entity.getBrokerId());
                if (brokerConfEntity == null) {
                    continue;
                }
                brokerCount++;
                topicProps = entity.getTopicProps();
                totalCfgTopicStoreCount += topicProps.getNumTopicStores();
                totalCfgNumPartCount +=
                        topicProps.getNumPartitions() * topicProps.getNumTopicStores();
                brokerRunManager.getPubBrokerTopicInfo(
                        entity.getBrokerId(), entity.getTopicName(), topicInfoTuple);
                if (topicInfoTuple.getF2() != null) {
                    if (topicInfoTuple.getF0() && topicInfoTuple.getF2().isAcceptPublish()) {
                        isSrvAcceptPublish = true;
                    }
                    if (topicInfoTuple.getF1() && topicInfoTuple.getF2().isAcceptSubscribe()) {
                        isSrvAcceptSubscribe = true;
                    }
                    totalRunTopicStoreCount += topicInfoTuple.getF2().getTopicStoreNum();
                    totalRunNumPartCount +=
                            topicInfoTuple.getF2().getPartitionNum() * topicInfoTuple.getF2().getTopicStoreNum();
                }
            }
            authEntity = defMetaDataService.getTopicCtrlByTopicName(entry.getKey());
            if (authEntity != null) {
                enableAuthControl = authEntity.isAuthCtrlEnable();
            }
            sBuffer.append("{\"topicName\":\"").append(entry.getKey())
                    .append("\",\"totalCfgBrokerCnt\":").append(brokerCount)
                    .append(",\"totalCfgNumStore\":").append(totalCfgTopicStoreCount)
                    .append(",\"totalRunNumStore\":").append(totalRunTopicStoreCount)
                    .append(",\"totalCfgNumPart\":").append(totalCfgNumPartCount)
                    .append(",\"totalRunNumPartCount\":").append(totalRunNumPartCount)
                    .append(",\"isSrvAcceptPublish\":").append(isSrvAcceptPublish)
                    .append(",\"isSrvAcceptSubscribe\":").append(isSrvAcceptSubscribe)
                    .append(",\"enableAuthControl\":").append(enableAuthControl)
                    .append("}");
        }
        WebParameterUtils.buildSuccessWithDataRetEnd(sBuffer, totalCount);
        return sBuffer;
    }
Query cluster topic overall view

@param req       Http Servlet Request
@param sBuffer   string buffer
@param result    process result
@return    process result
inlong-tubemq/tubemq-server/src/main/java/org/apache/inlong/tubemq/server/master/web/handler/WebMasterInfoHandler.java