private boolean tryRegister2Broker(Partition partition, long boostrapOffset,
            ProcessResult result, StringBuilder sBuffer) {
        try {
            ClientBroker.RegisterResponseB2C response =
                    getBrokerService(partition.getBroker()).consumerRegisterC2B(
                            createBrokerRegisterRequest(partition, boostrapOffset),
                            AddressUtils.getLocalAddress(), consumerConfig.isTlsEnable());
            if (response == null) {
                clientStatsInfo.bookReg2Broker(true);
                result.setFailResult(TErrCodeConstants.CONNECT_RETURN_NULL,
                        sBuffer.append(" register ").append(partition.toString())
                                .append(" return null!").toString());
                return result.isSuccess();
            }
            if (response.getSuccess()) {
                clientStatsInfo.bookReg2Broker(false);
                long currOffset = response.hasCurrOffset()
                        ? response.getCurrOffset()
                        : TBaseConstants.META_VALUE_UNDEFINED;
                long maxOffset = response.hasMaxOffset()
                        ? response.getMaxOffset()
                        : TBaseConstants.META_VALUE_UNDEFINED;
                clientRmtDataCache.addPartition(partition, currOffset, maxOffset);
                logger.info(sBuffer.append("Registered partition: consumer is ")
                        .append(consumerId).append(", partition=")
                        .append(partition.toString()).append(", boostrapOffset=")
                        .append(boostrapOffset).toString());
                sBuffer.delete(0, sBuffer.length());
                result.setSuccResult();
                return result.isSuccess();
            } else {
                clientStatsInfo.bookReg2Broker(true);
                if (response.getErrCode() == TErrCodeConstants.PARTITION_OCCUPIED
                        || response.getErrCode() == TErrCodeConstants.CERTIFICATE_FAILURE) {
                    clientRmtDataCache.removePartition(partition);
                    if (response.getErrCode() == TErrCodeConstants.PARTITION_OCCUPIED) {
                        result.setFailResult(response.getErrCode(),
                                sBuffer.append("[Partition occupied], curr consumerId: ")
                                        .append(consumerId).append(", returned message : ")
                                        .append(response.getErrMsg()).toString());
                    } else {
                        result.setFailResult(response.getErrCode(),
                                sBuffer.append("[Certificate failure], curr consumerId: ")
                                        .append(consumerId).append(", returned message : ")
                                        .append(response.getErrMsg()).toString());
                    }
                } else {
                    result.setFailResult(response.getErrCode(),
                            sBuffer.append(" register ").append(partition.toString())
                                    .append(" return ").append(response.getErrMsg()).toString());
                }
                sBuffer.delete(0, sBuffer.length());
                return result.isSuccess();
            }
        } catch (Throwable e) {
            sBuffer.delete(0, sBuffer.length());
            result.setFailResult(TErrCodeConstants.UNSPECIFIED_ABNORMAL,
                    sBuffer.append("register ").append(partition.toString())
                            .append(" throw exception ").append(e.toString()).toString());
            sBuffer.delete(0, sBuffer.length());
            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