Code review comment: Thank you, I agree it doesn't hold a reference to a variable here. Implemented!

Code under review:
private void flush() {
        while (inFlightRequestsCount >= maxInFlightRequests) {
            mailboxExecutor.tryYield();
        }

        List<RequestEntryT> batch = new ArrayList<>(maxBatchSize);

        int batchSize = Math.min(maxBatchSize, bufferedRequestEntries.size());
        int batchSizeBytes = 0;
        for (int i = 0; i < batchSize; i++) {
            RequestEntryWrapper<RequestEntryT> elem = bufferedRequestEntries.remove();
            batch.add(elem.getRequestEntry());
            bufferedRequestEntriesTotalSizeInBytes -= elem.getSize();
            batchSizeBytes += elem.getSize();
        }

        if (batch.size() == 0) {
            return;
        }

        long timestampOfRequest = System.currentTimeMillis();
        Consumer<Collection<RequestEntryT>> requestResult =
                failedRequestEntries ->
                        mailboxExecutor.execute(
                                () -> completeRequest(failedRequestEntries, timestampOfRequest),
                                "Mark in-flight request as completed and requeue %d request entries",
                                failedRequestEntries.size());

        Consumer<Exception> fatalExceptionCons =
                exception ->
                        mailboxExecutor.execute(
                                () -> {
                                    throw exception;
                                },
                                "A fatal exception occurred in the sink that cannot be recovered from or should not be retried.");

        inFlightRequestsCount++;
        submitRequestEntries(batch, requestResult, fatalExceptionCons);
        numRecordsOutCounter.inc(batchSize);
        numBytesOutCounter.inc(batchSizeBytes);
    }

Line commented on: Consumer<Exception> fatalExceptionCons =

Revised code:
private void flush() {
        while (inFlightRequestsCount >= maxInFlightRequests) {
            mailboxExecutor.tryYield();
        }

        List<RequestEntryT> batch = new ArrayList<>(maxBatchSize);

        int batchSize = Math.min(maxBatchSize, bufferedRequestEntries.size());
        int batchSizeBytes = 0;
        for (int i = 0; i < batchSize; i++) {
            RequestEntryWrapper<RequestEntryT> elem = bufferedRequestEntries.remove();
            batch.add(elem.getRequestEntry());
            bufferedRequestEntriesTotalSizeInBytes -= elem.getSize();
            batchSizeBytes += elem.getSize();
        }

        if (batch.size() == 0) {
            return;
        }

        long timestampOfRequest = System.currentTimeMillis();
        Consumer<Collection<RequestEntryT>> requestResult =
                failedRequestEntries ->
                        mailboxExecutor.execute(
                                () -> completeRequest(failedRequestEntries, timestampOfRequest),
                                "Mark in-flight request as completed and requeue %d request entries",
                                failedRequestEntries.size());

        inFlightRequestsCount++;
        submitRequestEntries(batch, requestResult);
        numRecordsOutCounter.inc(batchSize);
        numBytesOutCounter.inc(batchSizeBytes);
    }