@Override
    public boolean asyncSendMessage(
            TcpEventInfo eventInfo, MsgSendCallback callback, ProcessResult procResult) {
        validParamsNotNull(eventInfo, callback, procResult);
        if (!this.isStarted()) {
            return procResult.setFailResult(ErrorCode.SDK_CLOSED);
        }
        boolean gotPermits = false;
        try {
            if (!tryAcquireCachePermits(eventInfo.getBodySize(), procResult)) {
                return false;
            }
            gotPermits = true;
            return processEvent(SendQos.SOURCE_ACK, eventInfo, callback, procResult);
        } finally {
            if (procResult.isSuccess()) {
                metricHolder.addAsyncSucReqMetric(
                        eventInfo.getGroupId(), eventInfo.getStreamId(), eventInfo.getMsgCnt());
            } else {
                if (gotPermits) {
                    releaseCachePermits(eventInfo.getBodySize());
                }
                metricHolder.addAsyncFailReqMetric(procResult.getErrCode(),
                        eventInfo.getGroupId(), eventInfo.getStreamId(), eventInfo.getMsgCnt());
            }
        }
    }
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