Class BatchProcessor.Builder

java.lang.Object
org.influxdb.impl.BatchProcessor.Builder
Enclosing class:
BatchProcessor

public static final class BatchProcessor.Builder
extends Object
The Builder to create a BatchProcessor instance.
  • Constructor Details

    • Builder

      public Builder​(InfluxDB influxDB)
      Parameters:
      influxDB - is mandatory.
  • Method Details

    • threadFactory

      public BatchProcessor.Builder threadFactory​(ThreadFactory threadFactory)
      Parameters:
      threadFactory - is optional.
      Returns:
      this Builder to use it fluent
    • actions

      public BatchProcessor.Builder actions​(int maxActions)
      The number of actions after which a batchwrite must be performed.
      Parameters:
      maxActions - number of Points written after which a write must happen.
      Returns:
      this Builder to use it fluent
    • interval

      public BatchProcessor.Builder interval​(int interval, TimeUnit unit)
      The interval at which at least should issued a write.
      Parameters:
      interval - the interval
      unit - the TimeUnit of the interval
      Returns:
      this Builder to use it fluent
    • interval

      public BatchProcessor.Builder interval​(int flushInterval, int jitterInterval, TimeUnit unit)
      The interval at which at least should issued a write.
      Parameters:
      flushInterval - the flush interval
      jitterInterval - the flush jitter interval
      unit - the TimeUnit of the interval
      Returns:
      this Builder to use it fluent
    • bufferLimit

      public BatchProcessor.Builder bufferLimit​(int bufferLimit)
      A buffer for failed writes so that the writes will be retried later on. When the buffer is full and new points are written, oldest entries in the buffer are lost.
      Parameters:
      bufferLimit - maximum number of points stored in the buffer
      Returns:
      this Builder to use it fluent
    • exceptionHandler

      public BatchProcessor.Builder exceptionHandler​(BiConsumer<Iterable<Point>,​Throwable> handler)
      A callback to be used when an error occurs during a batchwrite.
      Parameters:
      handler - the handler
      Returns:
      this Builder to use it fluent
    • dropActionsOnQueueExhaustion

      public BatchProcessor.Builder dropActionsOnQueueExhaustion​(boolean dropActionsOnQueueExhaustion)
      To define the behaviour when the action queue exhausts. If unspecified, will default to false which means that the InfluxDB.write(Point) will be blocked till the space in the queue is created. true means that the newer actions being written to the queue will dropped and BatchProcessor.droppedActionHandler will be called.
      Parameters:
      dropActionsOnQueueExhaustion - the dropActionsOnQueueExhaustion
      Returns:
      this Builder to use it fluent
    • droppedActionHandler

      public BatchProcessor.Builder droppedActionHandler​(Consumer<Point> handler)
      A callback to be used when an actions are dropped on action queue exhaustion.
      Parameters:
      handler - the handler
      Returns:
      this Builder to use it fluent
    • consistencyLevel

      public BatchProcessor.Builder consistencyLevel​(InfluxDB.ConsistencyLevel consistencyLevel)
      Consistency level for batch write.
      Parameters:
      consistencyLevel - the consistencyLevel
      Returns:
      this Builder to use it fluent
    • precision

      public BatchProcessor.Builder precision​(TimeUnit precision)
      Set the time precision to use for the batch.
      Parameters:
      precision - the precision
      Returns:
      this Builder to use it fluent
    • build

      public BatchProcessor build()
      Create the BatchProcessor.
      Returns:
      the BatchProcessor instance.