code: public Future<WriteResponse> write (Batch<String> batch, WriteCallback callback) {
      Timer.Context context = writeTimer.time();
      int returnCode = 0;
      LOG.info ("Dispatching batch " + batch.getId());
      recordsAttempted.mark(batch.getRecords().size());
      try {
        String encoded = encodeBatch(batch);
        returnCode = request (encoded);
        WriteResponse<Integer> response = WRITE_RESPONSE_WRAPPER.wrap(returnCode);
        callback.onSuccess(response);
        bytesWritten.mark(encoded.length());
        recordsSuccess.mark(batch.getRecords().size());
      } catch (Exception e) {
        LOG.error("Dispatching batch " + batch.getId() + " failed :" + e.toString());
        callback.onFailure(e);
        recordsFailed.mark(batch.getRecords().size());
      }
  
      context.close();
      Future<Integer> future = Futures.immediateFuture(returnCode);
      return new WriteResponseFuture<>(future, WRITE_RESPONSE_WRAPPER);
    }
docs: Write a whole batch to eventhub