private RegisterResponseB2C inProcessConsumerUnregister(final String clientId, final String groupName,
            final String topicName, final String partStr,
            RegisterRequestC2B request, boolean overtls,
            RegisterResponseB2C.Builder builder,
            StringBuilder strBuffer) {
        logger.info(strBuffer.append("[Consumer Unregister]").append(clientId)
                .append(", isOverTLS=").append(overtls).toString());
        strBuffer.delete(0, strBuffer.length());
        ConsumerNodeInfo consumerNodeInfo = consumerRegisterMap.get(partStr);
        if (consumerNodeInfo == null) {
            logger.warn(strBuffer.append("[UnRegistered Consumer2]").append(clientId)
                    .append(TokenConstants.SEGMENT_SEP).append(partStr).toString());
            strBuffer.delete(0, strBuffer.length());
            builder.setErrCode(TErrCodeConstants.HB_NO_NODE);
            builder.setErrMsg(strBuffer.append("UnRegistered Consumer ")
                    .append(clientId).append(", you have to register firstly!").toString());
            return builder.build();
        }
        if (!clientId.equals(consumerNodeInfo.getConsumerId())) {
            String message = strBuffer.append("[Duplicated Request]").append("Partition ").append(partStr)
                    .append(" has been consumed by ").append(consumerNodeInfo.getConsumerId())
                    .append(";Current consumer ").append(clientId).toString();
            logger.warn(message);
            builder.setErrCode(TErrCodeConstants.DUPLICATE_PARTITION);
            builder.setErrMsg(strBuffer.append(", broker=").append(tubeConfig.getHostName()).toString());
            return builder.build();
        }
        try {
            int readStatus = request.getReadStatus();
            long updatedOffset =
                    offsetManager.commitOffset(groupName, topicName,
                            request.getPartitionId(), readStatus == 0);
            logger.info(strBuffer.append("[Unregister Offset] update lastOffset, ")
                    .append(groupName).append(" topic:").append(topicName).append(" partition:")
                    .append(request.getPartitionId()).append(" updatedOffset:").append(updatedOffset).toString());
            strBuffer.delete(0, strBuffer.length());
            if (consumerRegisterMap.remove(partStr) != null) {
                BrokerSrvStatsHolder.decConsumeOnlineCnt(false);
            }
            heartbeatManager.unRegConsumerNode(
                    getHeartbeatNodeId(clientId, partStr));
        } catch (Exception e) {
            strBuffer.delete(0, strBuffer.length());
            String message = strBuffer.append("Unregister consumer:")
                    .append(clientId).append(" failed.").toString();
            logger.warn(message, e);
            builder.setErrCode(TErrCodeConstants.INTERNAL_SERVER_ERROR);
            builder.setErrMsg(strBuffer.append(" exception is ").append(e.getMessage()).toString());
            return builder.build();
        }
        builder.setSuccess(true);
        builder.setErrCode(TErrCodeConstants.SUCCESS);
        builder.setErrMsg("OK!");
        return builder.build();
    }
Handle consumer's unregister request.

@param clientId     the client id
@param groupName    the group name
@param topicName    the topic name
@param partStr      the group-topic-partitionId key
@param request      the request
@param overtls      whether transfer over TLS
@param builder      the response builder
@param strBuffer    the string buffer
@return             the response
inlong-tubemq/tubemq-server/src/main/java/org/apache/inlong/tubemq/server/broker/BrokerServiceServer.java