private void processEventAttrsInfo(
            SendQos sendQos, TcpEventInfo eventInfo, EncodeObject encodeObject) {
        // get msgType
        int intMsgType = encodeObject.getMsgType().getValue();
        boolean enableDataComp = tcpConfig.isEnableDataCompress()
                && eventInfo.getBodySize() >= tcpConfig.getMinCompEnableLength();
        // add fixed attributes
        Map<String, String> newAttrs = new HashMap<>(eventInfo.getAttrs());
        newAttrs.put(AttributeConstants.MSG_RPT_TIME, String.valueOf(encodeObject.getRtms()));
        newAttrs.put(AttributeConstants.PROXY_SDK_VERSION, ProxyUtils.getJarVersion());

        if (sendQos == SendQos.NO_ACK) {
            newAttrs.put(AttributeConstants.MESSAGE_IS_ACK, String.valueOf(true));
        } else if (sendQos == SendQos.SINK_ACK) {
            newAttrs.put(AttributeConstants.MESSAGE_PROXY_SEND, String.valueOf(true));
        }
        if (tcpConfig.getSdkMsgType() == MsgType.MSG_ACK_SERVICE
                || tcpConfig.getSdkMsgType() == MsgType.MSG_MULTI_BODY) {
            // add msgType 3/5 attributes
            newAttrs.put(AttributeConstants.GROUP_ID, eventInfo.getGroupId());
            newAttrs.put(AttributeConstants.STREAM_ID, eventInfo.getStreamId());
            newAttrs.put(AttributeConstants.DATA_TIME, String.valueOf(eventInfo.getDtMs()));
            newAttrs.put(AttributeConstants.MESSAGE_COUNT, String.valueOf(eventInfo.getMsgCnt()));
            if (enableDataComp) {
                newAttrs.put(AttributeConstants.COMPRESS_TYPE, "snappy");
            }
        } else {
            // add msgType 7 attributes
            if (enableDataComp) {
                intMsgType |= SdkConsts.FLAG_ALLOW_COMPRESS;
            }
            int extField = 0;
            if (tcpConfig.isSeparateEventByLF()) {
                extField |= SdkConsts.EXT_FIELD_FLAG_SEP_BY_LF;
            }
            boolean id2Num = false;
            int streamIdNum = 0;
            if (this.idTransNum && (this.groupIdNum != 0)
                    && eventInfo.getGroupId().equals(tcpConfig.getInlongGroupId())) {
                streamIdNum = getStreamIdNum(eventInfo.getStreamId());
                id2Num = streamIdNum != 0;
            }
            if (id2Num) {
                encodeObject.setGroupAndStreamId2Num(this.groupIdNum, streamIdNum);
            } else {
                extField |= SdkConsts.EXT_FIELD_FLAG_DISABLE_ID2NUM;
                newAttrs.put(AttributeConstants.GROUP_ID, eventInfo.getGroupId());
                newAttrs.put(AttributeConstants.STREAM_ID, eventInfo.getStreamId());
            }
            encodeObject.setExtField(extField);
        }
        byte[] aesKey = null;
        // set encrypt attributes
        if (tcpConfig.isEnableReportEncrypt()) {
            EncryptConfigEntry encryptEntry = configManager.getUserEncryptConfigEntry();
            newAttrs.put("_userName", tcpConfig.getRptUserName());
            newAttrs.put("_encyVersion", encryptEntry.getVersion());
            newAttrs.put("_encyAesKey", encryptEntry.getRsaEncryptedKey());
            aesKey = encryptEntry.getAesKey();
            intMsgType |= SdkConsts.FLAG_ALLOW_ENCRYPT;
        }
        encodeObject.setAttrInfo(intMsgType, enableDataComp, aesKey, newAttrs);
    }
TCP Message Sender class

Used to define the TCP sender common methods
inlong-sdk/dataproxy-sdk/src/main/java/org/apache/inlong/sdk/dataproxy/sender/tcp/InLongTcpMsgSender.java