public boolean addEvent(Event event, long maxPackCount, long maxPackSize) {
        long eventLength = event.getBody().length;
        if (count >= maxPackCount || (count > 0 && size + eventLength > maxPackSize)) {
            return false;
        }
        this.events.add((ProxyEvent) event);
        this.count++;
        this.size += eventLength;
        return true;
    }
addEvent

@param  event   the event to added
@param  maxPackCount   the max package count to cached
@param  maxPackSize    the max package size to cached
@return  whether added the event
inlong-dataproxy/dataproxy-source/src/main/java/org/apache/inlong/dataproxy/sink/mq/BatchPackProfile.java