public void produce(List<ProducerRecord<String, String>> recordsToProduce, Integer batchSize) {
        int counter = 1;
        for (ProducerRecord<String, String> record : recordsToProduce) {
            producer.send(record);
            if (counter++ % batchSize == 0) {
                producer.flush();
            }
        }
        producer.flush();
    }
Send the given records trying to honor the batch size. This is attempted
with a large producer linger and the use of an explicit flush every time
the number of a "group" of records reaches the batch size.
@param recordsToProduce the records to produce
@param batchSize the batch size
storage/src/test/java/org/apache/kafka/tiered/storage/TieredStorageTestContext.java