@Override
    public HeartResponseM2CV2 consumerHeartbeatC2MV2(HeartRequestC2MV2 request,
            String rmtAddress,
            boolean overtls) throws Throwable {
        ProcessResult result = new ProcessResult();
        final StringBuilder strBuff = new StringBuilder(512);
        // response
        HeartResponseM2CV2.Builder builder = HeartResponseM2CV2.newBuilder();
        // identity valid
        if (!serverAuthHandler.identityValidUserInfo(request.getAuthInfo(), false, result)) {
            builder.setErrCode(result.getErrCode());
            builder.setErrMsg(result.getErrMsg());
            return builder.build();
        }
        final CertifiedInfo certifiedInfo = (CertifiedInfo) result.getRetData();
        if (!PBParameterUtils.checkClientId(request.getClientId(), strBuff, result)) {
            builder.setErrCode(result.getErrCode());
            builder.setErrMsg(result.getErrMsg());
            return builder.build();
        }
        final String clientId = (String) result.getRetData();
        if (!PBParameterUtils.checkGroupName(request.getGroupName(), strBuff, result)) {
            builder.setErrCode(result.getErrCode());
            builder.setErrMsg(result.getErrMsg());
            return builder.build();
        }
        final String groupName = (String) result.getRetData();
        OpsSyncInfo opsTaskInfo = new OpsSyncInfo();
        if (request.hasOpsTaskInfo()) {
            opsTaskInfo.updOpsSyncInfo(request.getOpsTaskInfo());
        }
        // check master current status
        checkNodeStatus(clientId, strBuff);
        ClientSyncInfo clientSyncInfo = new ClientSyncInfo();
        if (request.hasSubRepInfo()) {
            clientSyncInfo.updSubRepInfo(brokerRunManager, request.getSubRepInfo());
        }
        ConsumeGroupInfo consumeGroupInfo = consumerHolder.getConsumeGroupInfo(groupName);
        if (consumeGroupInfo == null) {
            builder.setErrCode(TErrCodeConstants.HB_NO_NODE);
            builder.setErrMsg(strBuff.append("Not found groupName ")
                    .append(groupName).append(" in holder!").toString());
            return builder.build();
        }
        ConsumerInfo inConsumerInfo =
                consumeGroupInfo.getConsumerInfo(clientId);
        if (inConsumerInfo == null) {
            builder.setErrCode(TErrCodeConstants.HB_NO_NODE);
            builder.setErrMsg(strBuff.append("Not found client ").append(clientId)
                    .append(" in group(").append(groupName).append(")").toString());
            strBuff.delete(0, strBuff.length());
            return builder.build();
        }
        // authorize check
        if (!serverAuthHandler.validConsumerAuthorizeInfo(certifiedInfo.getUserName(),
                groupName, consumeGroupInfo.getTopicSet(),
                consumeGroupInfo.getTopicConditions(), rmtAddress, result)) {
            builder.setErrCode(result.getErrCode());
            builder.setErrMsg(result.getErrMsg());
            return builder.build();
        }
        // heartbeat check
        try {
            heartbeatManager.updConsumerNode(getConsumerKey(groupName, clientId));
        } catch (HeartbeatException e) {
            builder.setErrCode(TErrCodeConstants.HB_NO_NODE);
            builder.setErrMsg(strBuff
                    .append("Update consumer node exception:")
                    .append(e.getMessage()).toString());
            return builder.build();
        }
        inConsumerInfo.updClientReportInfo(opsTaskInfo.getCsmFromMaxOffsetCtrlId(),
                clientSyncInfo.getLstAssignedTime(), clientSyncInfo.getTopicMetaInfoId());
        Tuple2<Boolean, Set<Partition>> reportInfo = clientSyncInfo.getRepSubInfo();
        if (reportInfo.getF0()) {
            Map<String, Map<String, Partition>> curPartSubMap =
                    currentSubInfo.get(clientId);
            Map<String, Map<String, Partition>> newPartSubMap = new HashMap<>();
            for (Partition info : reportInfo.getF1()) {
                Map<String, Partition> partMap =
                        newPartSubMap.computeIfAbsent(info.getTopic(), k -> new HashMap<>());
                partMap.put(info.getPartitionKey(), info);
            }
            printReportInfo(clientId, curPartSubMap, newPartSubMap, strBuff);
            currentSubInfo.put(clientId, newPartSubMap);
        }
        Tuple2<Long, Map<Integer, String>> brokerStaticInfo =
                brokerRunManager.getBrokerStaticInfo(overtls);
        builder.setBrokerConfigId(brokerStaticInfo.getF0());
        if (clientSyncInfo.getBrokerConfigId() != brokerStaticInfo.getF0()) {
            builder.addAllBrokerConfigList(brokerStaticInfo.getF1().values());
        }
        Map<String, Map<String, Partition>> curPartMap = currentSubInfo.get(clientId);
        if (inConsumerInfo.getLstAssignedTime() >= 0
                && (curPartMap != null && !curPartMap.isEmpty())
                && (System.currentTimeMillis() - inConsumerInfo.getLstAssignedTime() > masterConfig
                        .getMaxMetaForceUpdatePeriodMs())) {
            Tuple2<Long, List<String>> topicMetaInfoTuple = consumeGroupInfo.getTopicMetaInfo();
            builder.setTopicMetaInfoId(topicMetaInfoTuple.getF0());
            if (topicMetaInfoTuple.getF0() != clientSyncInfo.getTopicMetaInfoId()) {
                builder.addAllTopicMetaInfoList(topicMetaInfoTuple.getF1());
            }
        }
        builder.setOpsTaskInfo(buildOpsTaskInfo(consumeGroupInfo, inConsumerInfo, opsTaskInfo));
        builder.setAuthorizedInfo(genAuthorizedInfo(certifiedInfo.getAuthorizedToken(), false));
        builder.setErrCode(TErrCodeConstants.SUCCESS);
        builder.setErrMsg("OK!");
        return builder.build();
    }
Client balance consumer heartbeat request with master

@param request
@param rmtAddress
@param overtls
@return heartbeat response
@throws Throwable
inlong-tubemq/tubemq-server/src/main/java/org/apache/inlong/tubemq/server/master/TMaster.java