@Override
    public HeartResponseM2P producerHeartbeatP2M(HeartRequestP2M request,
            final String rmtAddress,
            boolean overtls) throws Exception {
        ProcessResult result = new ProcessResult();
        final StringBuilder strBuff = new StringBuilder(512);
        HeartResponseM2P.Builder builder = HeartResponseM2P.newBuilder();
        builder.setSuccess(false);
        builder.setBrokerCheckSum(-1);
        if (!serverAuthHandler.identityValidUserInfo(request.getAuthInfo(), true, 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 producerId = (String) result.getRetData();
        if (!PBParameterUtils.checkHostName(request.getHostName(), strBuff, result)) {
            builder.setErrCode(result.getErrCode());
            builder.setErrMsg(result.getErrMsg());
            return builder.build();
        }
        final String hostName = (String) result.getRetData();
        if (!PBParameterUtils.checkProducerTopicList(request.getTopicListList(), strBuff, result)) {
            builder.setErrCode(result.getErrCode());
            builder.setErrMsg(result.getErrMsg());
            return builder.build();
        }
        final Set<String> transTopicSet = (Set<String>) result.getRetData();
        if (!request.hasBrokerCheckSum()) {
            builder.setErrCode(TErrCodeConstants.BAD_REQUEST);
            builder.setErrMsg("Request miss necessary brokerCheckSum field!");
            return builder.build();
        }
        final long inBrokerCheckSum = request.getBrokerCheckSum();
        checkNodeStatus(producerId, strBuff);
        if (!serverAuthHandler.validProducerAuthorizeInfo(
                certifiedInfo.getUserName(), transTopicSet, rmtAddress, result)) {
            builder.setErrCode(result.getErrCode());
            builder.setErrMsg(result.getErrMsg());
            return builder.build();
        }
        try {
            heartbeatManager.updProducerNode(producerId);
        } catch (HeartbeatException e) {
            builder.setErrCode(TErrCodeConstants.HB_NO_NODE);
            builder.setErrMsg(e.getMessage());
            return builder.build();
        }
        topicPSInfoManager.addProducerTopicPubInfo(producerId, transTopicSet);
        producerHolder.updateProducerInfo(producerId,
                transTopicSet, hostName, overtls);
        // get current configure information and set
        Tuple2<Long, Map<Integer, String>> brokerStaticInfo =
                brokerRunManager.getBrokerStaticInfo(overtls);
        final Tuple3<Long, Integer, Map<String, String>> prodTopicConfigTuple =
                getTopicConfigureInfos(producerId, false);
        builder.setAuthorizedInfo(genAuthorizedInfo(
                certifiedInfo.getAuthorizedToken(), false).build());
        builder.setBrokerCheckSum(brokerStaticInfo.getF0());
        if (brokerStaticInfo.getF0() != inBrokerCheckSum) {
            builder.addAllBrokerInfos(brokerStaticInfo.getF1().values());
        }
        if (prodTopicConfigTuple.getF2() != null) {
            builder.addAllTopicInfos(prodTopicConfigTuple.getF2().values());
        }
        ClientMaster.ApprovedClientConfig.Builder clientConfigBuilder =
                buildApprovedClientConfig(request.getAppdConfig(), prodTopicConfigTuple);
        if (clientConfigBuilder != null) {
            builder.setAppdConfig(clientConfigBuilder);
        }
        if (logger.isDebugEnabled()) {
            logger.debug(strBuff.append("[Push Producer's available topic count:]")
                    .append(producerId).append(TokenConstants.LOG_SEG_SEP)
                    .append((prodTopicConfigTuple.getF2() == null)
                            ? 0
                            : prodTopicConfigTuple.getF2().size())
                    .toString());
        }
        builder.setSuccess(true);
        builder.setErrCode(TErrCodeConstants.SUCCESS);
        builder.setErrMsg("OK!");
        return builder.build();
    }
Producer 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