private Map inGetTopicConfStrInfo()

in inlong-tubemq/tubemq-server/src/main/java/org/apache/inlong/tubemq/server/master/metamanage/DefaultMetaDataService.java [752:858]


    private Map<String, String> inGetTopicConfStrInfo(BrokerConfEntity brokerEntity,
            boolean isRemoved, StringBuilder strBuff) {
        Map<String, String> topicConfStrMap = new HashMap<>();
        Map<String, TopicDeployEntity> topicEntityMap =
                metaConfigMapper.getConfiguredTopicInfo(brokerEntity.getBrokerId());
        if (topicEntityMap.isEmpty()) {
            return topicConfStrMap;
        }
        TopicPropGroup defTopicProps = brokerEntity.getTopicProps();
        ClusterSettingEntity clusterDefConf = metaConfigMapper.getClusterDefSetting(false);
        int defMsgSizeInB = clusterDefConf.getMaxMsgSizeInB();
        for (TopicDeployEntity topicEntity : topicEntityMap.values()) {
            /*
             * topic:partNum:acceptPublish:acceptSubscribe:unflushThreshold:unflushInterval:deleteWhen:
             * deletePolicy:filterStatusId:statusId
             */
            if ((isRemoved && !topicEntity.isInRemoving())
                    || (!isRemoved && topicEntity.isInRemoving())) {
                continue;
            }
            strBuff.append(topicEntity.getTopicName());
            TopicPropGroup topicProps = topicEntity.getTopicProps();
            if (topicProps.getNumPartitions() == TBaseConstants.META_VALUE_UNDEFINED
                    || topicProps.getNumPartitions() == defTopicProps.getNumPartitions()) {
                strBuff.append(TokenConstants.ATTR_SEP).append(" ");
            } else {
                strBuff.append(TokenConstants.ATTR_SEP).append(topicProps.getNumPartitions());
            }
            if (topicProps.getAcceptPublish() == null
                    || topicProps.isAcceptPublish() == defTopicProps.isAcceptPublish()) {
                strBuff.append(TokenConstants.ATTR_SEP).append(" ");
            } else {
                strBuff.append(TokenConstants.ATTR_SEP).append(topicProps.isAcceptPublish());
            }
            if (topicProps.getAcceptSubscribe() == null
                    || topicProps.isAcceptSubscribe() == defTopicProps.isAcceptSubscribe()) {
                strBuff.append(TokenConstants.ATTR_SEP).append(" ");
            } else {
                strBuff.append(TokenConstants.ATTR_SEP).append(topicProps.isAcceptSubscribe());
            }
            if (topicProps.getUnflushThreshold() == TBaseConstants.META_VALUE_UNDEFINED
                    || topicProps.getUnflushThreshold() == defTopicProps.getUnflushThreshold()) {
                strBuff.append(TokenConstants.ATTR_SEP).append(" ");
            } else {
                strBuff.append(TokenConstants.ATTR_SEP).append(topicProps.getUnflushThreshold());
            }
            if (topicProps.getUnflushInterval() == TBaseConstants.META_VALUE_UNDEFINED
                    || topicProps.getUnflushInterval() == defTopicProps.getUnflushInterval()) {
                strBuff.append(TokenConstants.ATTR_SEP).append(" ");
            } else {
                strBuff.append(TokenConstants.ATTR_SEP).append(topicProps.getUnflushInterval());
            }
            strBuff.append(TokenConstants.ATTR_SEP).append(" ");
            if (TStringUtils.isEmpty(topicProps.getDeletePolicy())
                    || topicProps.getDeletePolicy().equals(defTopicProps.getDeletePolicy())) {
                strBuff.append(TokenConstants.ATTR_SEP).append(" ");
            } else {
                strBuff.append(TokenConstants.ATTR_SEP).append(topicProps.getDeletePolicy());
            }
            if (topicProps.getNumTopicStores() == TBaseConstants.META_VALUE_UNDEFINED
                    || topicProps.getNumTopicStores() == defTopicProps.getNumTopicStores()) {
                strBuff.append(TokenConstants.ATTR_SEP).append(" ");
            } else {
                strBuff.append(TokenConstants.ATTR_SEP).append(topicProps.getNumTopicStores());
            }
            strBuff.append(TokenConstants.ATTR_SEP).append(topicEntity.getTopicStatusId());
            if (topicProps.getUnflushDataHold() == TBaseConstants.META_VALUE_UNDEFINED
                    || topicProps.getUnflushDataHold() == defTopicProps.getUnflushDataHold()) {
                strBuff.append(TokenConstants.ATTR_SEP).append(" ");
            } else {
                strBuff.append(TokenConstants.ATTR_SEP).append(topicProps.getUnflushDataHold());
            }
            if (topicProps.getMemCacheMsgSizeInMB() == TBaseConstants.META_VALUE_UNDEFINED
                    || topicProps.getMemCacheMsgSizeInMB() == defTopicProps.getMemCacheMsgSizeInMB()) {
                strBuff.append(TokenConstants.ATTR_SEP).append(" ");
            } else {
                strBuff.append(TokenConstants.ATTR_SEP).append(topicProps.getMemCacheMsgSizeInMB());
            }
            if (topicProps.getMemCacheMsgCntInK() == TBaseConstants.META_VALUE_UNDEFINED
                    || topicProps.getMemCacheMsgCntInK() == defTopicProps.getMemCacheMsgCntInK()) {
                strBuff.append(TokenConstants.ATTR_SEP).append(" ");
            } else {
                strBuff.append(TokenConstants.ATTR_SEP).append(topicProps.getMemCacheMsgCntInK());
            }
            if (topicProps.getMemCacheFlushIntvl() == TBaseConstants.META_VALUE_UNDEFINED
                    || topicProps.getMemCacheFlushIntvl() == defTopicProps.getMemCacheFlushIntvl()) {
                strBuff.append(TokenConstants.ATTR_SEP).append(" ");
            } else {
                strBuff.append(TokenConstants.ATTR_SEP).append(topicProps.getMemCacheFlushIntvl());
            }
            int maxMsgSize = defMsgSizeInB;
            TopicCtrlEntity topicCtrlEntity =
                    metaConfigMapper.getTopicCtrlByTopicName(topicEntity.getTopicName());
            if (topicCtrlEntity != null
                    && topicCtrlEntity.getMaxMsgSizeInB() != TBaseConstants.META_VALUE_UNDEFINED) {
                maxMsgSize = topicCtrlEntity.getMaxMsgSizeInB();
            }
            if (maxMsgSize == defMsgSizeInB) {
                strBuff.append(TokenConstants.ATTR_SEP).append(" ");
            } else {
                strBuff.append(TokenConstants.ATTR_SEP).append(maxMsgSize);
            }
            topicConfStrMap.put(topicEntity.getTopicName(), strBuff.toString());
            strBuff.delete(0, strBuff.length());
        }
        return topicConfStrMap;
    }