private void responseV0Msg(Channel channel, AbsV0MsgCodec msgObj, StringBuilder strBuff) throws Exception {
        // check channel status
        if (channel == null || !channel.isWritable()) {
            source.fileMetricIncSumStats(StatConstants.EVENT_LINK_UNWRITABLE);
            if (logCounter.shouldPrint()) {
                logger.warn("Prepare send msg but channel full, msgType={}, attr={}, channel={}",
                        msgObj.getMsgType(), msgObj.getAttr(), channel);
            }
            throw new ChannelUnWritableException("Prepare send msg but channel full");
        }
        // check whether return response message
        if (!msgObj.isNeedResp()) {
            return;
        }
        // build return attribute string
        strBuff.append(ConfigConstants.DATAPROXY_IP_KEY)
                .append(AttributeConstants.KEY_VALUE_SEPARATOR).append(source.getSrcHost());
        if (msgObj.getErrCode() != DataProxyErrCode.SUCCESS) {
            strBuff.append(AttributeConstants.SEPARATOR).append(AttributeConstants.MESSAGE_PROCESS_ERRCODE)
                    .append(AttributeConstants.KEY_VALUE_SEPARATOR).append(msgObj.getErrCode().getErrCodeStr());
            if (StringUtils.isNotEmpty(msgObj.getErrMsg())) {
                strBuff.append(AttributeConstants.SEPARATOR).append(AttributeConstants.MESSAGE_PROCESS_ERRMSG)
                        .append(AttributeConstants.KEY_VALUE_SEPARATOR).append(msgObj.getErrMsg());
            }
        }
        if (StringUtils.isNotEmpty(msgObj.getAttr())) {
            strBuff.append(AttributeConstants.SEPARATOR).append(msgObj.getAttr());
        }
        // build and send response message
        ByteBuf retData;
        MsgType msgType = MsgType.valueOf(msgObj.getMsgType());
        if (MsgType.MSG_BIN_MULTI_BODY.equals(msgType)) {
            retData = buildBinMsgRspPackage(strBuff.toString(), msgObj.getUniq());
        } else {
            retData = buildTxtMsgRspPackage(msgType, strBuff.toString(), msgObj);
        }
        strBuff.delete(0, strBuff.length());
        flushV0MsgPackage(source, channel, retData, msgObj.getAttr());
    }
Return response to client in source
inlong-dataproxy/dataproxy-source/src/main/java/org/apache/inlong/dataproxy/source/ServerMessageHandler.java