Interface BatchWriter<T extends PersistentData>

Type Parameters:
T - the type of PersistentData to be written
All Superinterfaces:
AutoCloseable
All Known Implementing Classes:
AbstractSink.SinkWriter

public interface BatchWriter<T extends PersistentData> extends AutoCloseable

A writer interface for writing batches of data to a data store / sink.

Implementations of this interface should be thread-safe and should properly handle multiple concurrent writers.

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Flushes any buffered data to the underlying storage.
    boolean
    queueData(List<T> data)
    Queues a list of data for writing.
    default boolean
    queueData(T data)
    Queues data for writing.
    void
    setBatchSize(int batchSize)
    Sets the batch size for writing.

    Methods inherited from interface java.lang.AutoCloseable

    close
  • Method Details

    • queueData

      default boolean queueData(T data) throws Exception
      Queues data for writing.
      Parameters:
      data - the data to be written
      Returns:
      true if this queueing operation resulted in all data being flushed (due to batching)
      Throws:
      Exception - if an error occurs while queueing the data
    • queueData

      boolean queueData(List<T> data) throws Exception
      Queues a list of data for writing.
      Parameters:
      data - the list of data to be written
      Returns:
      true if this queueing operation resulted in all data being flushed (due to batching)
      Throws:
      Exception - if an error occurs while queueing the data
    • flush

      void flush() throws Exception
      Flushes any buffered data to the underlying storage.
      Throws:
      Exception - if an error occurs while flushing the data
    • setBatchSize

      void setBatchSize(int batchSize)
      Sets the batch size for writing.
      Parameters:
      batchSize - the new batch size