@Override
    public HeartResponseM2B brokerHeartbeatB2M(HeartRequestB2M request,
            final String rmtAddress,
            boolean overtls) throws Exception {
        // #lizard forgives
        final ProcessResult result = new ProcessResult();
        final StringBuilder strBuff = new StringBuilder(512);
        // set response field
        HeartResponseM2B.Builder builder = HeartResponseM2B.newBuilder();
        builder.setSuccess(false);
        builder.setStopRead(false);
        builder.setStopWrite(false);
        builder.setNeedReportData(true);
        builder.setTakeConfInfo(false);
        builder.setTakeRemoveTopicInfo(false);
        builder.setFlowCheckId(TBaseConstants.META_VALUE_UNDEFINED);
        builder.setQryPriorityId(TBaseConstants.META_VALUE_UNDEFINED);
        builder.setCurBrokerConfId(TBaseConstants.META_VALUE_UNDEFINED);
        builder.setConfCheckSumId(TBaseConstants.META_VALUE_UNDEFINED);
        // identity broker info
        if (!serverAuthHandler.identityValidBrokerInfo(request.getAuthInfo(), result)) {
            builder.setErrCode(result.getErrCode());
            builder.setErrMsg(result.getErrMsg());
            return builder.build();
        }
        if (!PBParameterUtils.checkBrokerId(request.getBrokerId(), strBuff, result)) {
            builder.setErrCode(result.getErrCode());
            builder.setErrMsg(result.getErrMsg());
            return builder.build();
        }
        int brokerId = (int) result.getRetData();
        long reFlowCtrlId = request.hasFlowCheckId()
                ? request.getFlowCheckId()
                : TBaseConstants.META_VALUE_UNDEFINED;
        int qryPriorityId = request.hasQryPriorityId()
                ? request.getQryPriorityId()
                : TBaseConstants.META_VALUE_UNDEFINED;
        checkNodeStatus(String.valueOf(brokerId), strBuff);
        if (!brokerRunManager.brokerHeartBeat2M(brokerId,
                request.getCurBrokerConfId(), request.getConfCheckSumId(),
                request.getTakeConfInfo(), request.getBrokerDefaultConfInfo(),
                request.getBrokerTopicSetConfInfoList(), request.getTakeRemovedTopicInfo(),
                request.getRemovedTopicsInfoList(), request.getReadStatusRpt(),
                request.getWriteStatusRpt(), request.getBrokerOnline(),
                strBuff, result)) {
            builder.setErrCode(result.getErrCode());
            builder.setErrMsg(result.getErrMsg());
            return builder.build();
        }
        if (request.getTakeConfInfo()) {
            strBuff.append("[Broker Report] heartbeat report: brokerId=")
                    .append(request.getBrokerId()).append(", configureId=")
                    .append(request.getCurBrokerConfId())
                    .append(",readStatusRpt=").append(request.getReadStatusRpt())
                    .append(",writeStatusRpt=").append(request.getWriteStatusRpt())
                    .append(",checksumId=").append(request.getConfCheckSumId())
                    .append(",hasFlowCheckId=").append(request.hasFlowCheckId())
                    .append(",reFlowCtrlId=").append(reFlowCtrlId)
                    .append(",qryPriorityId=").append(qryPriorityId)
                    .append(",brokerOnline=").append(request.getBrokerOnline())
                    .append(",default broker configure is ").append(request.getBrokerDefaultConfInfo())
                    .append(",broker topic configure is ").append(request.getBrokerTopicSetConfInfoList());
            strBuff.delete(0, strBuff.length());
        }
        // create response
        brokerRunManager.setHeatBeatDownConfInfo(brokerId, strBuff, builder);
        BrokerConfEntity brokerConfEntity =
                defMetaDataService.getBrokerConfByBrokerId(brokerId);
        builder.setTakeRemoveTopicInfo(true);
        builder.addAllRemoveTopicConfInfo(defMetaDataService
                .getBrokerRemovedTopicStrConfigInfo(brokerConfEntity, strBuff).values());
        builder.setSsdStoreId(TBaseConstants.META_VALUE_UNDEFINED);
        if (request.hasFlowCheckId()) {
            ClusterSettingEntity defSetting =
                    defMetaDataService.getClusterDefSetting(false);
            builder.setFlowCheckId(defSetting.getSerialId());
            builder.setQryPriorityId(defSetting.getQryPriorityId());
            if (reFlowCtrlId != defSetting.getSerialId()) {
                if (defSetting.enableFlowCtrl()) {
                    builder.setFlowControlInfo(defSetting.getGloFlowCtrlRuleInfo());
                } else {
                    builder.setFlowControlInfo(" ");
                }
            }
        }
        ClientMaster.ClusterConfig.Builder clusterConfigBuilder =
                buildClusterConfig(request.getClsConfig());
        if (clusterConfigBuilder != null) {
            builder.setClsConfig(clusterConfigBuilder);
        }
        // begin: deprecated when brokers version equal to current master version
        builder.setAuthorizedInfo(genAuthorizedInfo(null, true));
        // end deprecated
        builder.setBrokerAuthorizedInfo(genBrokerAuthorizedInfo(null));
        builder.setSuccess(true);
        builder.setErrCode(TErrCodeConstants.SUCCESS);
        builder.setErrMsg("OK!");
        return builder.build();
    }
Broker heartbeat request with master

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