private boolean startMasterAndBrokerThreads(ProcessResult result,
            StringBuilder sBuffer) {
        int registerRetryTimes = 0;
        while (registerRetryTimes < consumerConfig.getMaxRegisterRetryTimes()) {
            if (tryRegister2Master(result, sBuffer)) {
                logger.info(sBuffer.append("[Registered] ")
                        .append(consumerId).toString());
                sBuffer.delete(0, sBuffer.length());
                break;
            } else {
                logger.error(result.getErrMsg());
                ThreadUtils.sleep(this.consumerConfig.getRegFailWaitPeriodMs());
            }
            if (++registerRetryTimes >= consumerConfig.getMaxRegisterRetryTimes()) {
                logger.error(result.getErrMsg());
                return result.isSuccess();
            }
        }
        // to master heartbeat
        this.lastHeartbeatTime2Master = System.currentTimeMillis();
        this.heartService2Master.scheduleWithFixedDelay(new HeartTask2MasterWorker(),
                0, consumerConfig.getHeartbeatPeriodMs(), TimeUnit.MILLISECONDS);
        // to broker
        this.lastHeartbeatTime2Broker = System.currentTimeMillis();
        this.heartBeatThread2Broker = new Thread(new HeartTask2BrokerWorker());
        heartBeatThread2Broker.setName(sBuffer
                .append("Broker-Heartbeat-Thread-")
                .append(consumerId).toString());
        sBuffer.delete(0, sBuffer.length());
        heartBeatThread2Broker.setPriority(Thread.MAX_PRIORITY);
        heartBeatThread2Broker.start();
        result.setSuccResult();
        return result.isSuccess();
    }
Start heartbeat thread threads.

@param result  process result
@param sBuffer  string buffer

@return  process result
inlong-tubemq/tubemq-client/src/main/java/org/apache/inlong/tubemq/client/consumer/SimpleClientBalanceConsumer.java