Class WriteOptions.Builder

java.lang.Object
com.influxdb.client.WriteOptions.Builder
Enclosing class:
WriteOptions

@NotThreadSafe public static class WriteOptions.Builder extends Object
A builder for WriteOptions.
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • batchSize

      @Nonnull public WriteOptions.Builder batchSize(int batchSize)
      Set the number of data point to collect in batch.
      Parameters:
      batchSize - the number of data point to collect in batch
      Returns:
      this
    • flushInterval

      @Nonnull public WriteOptions.Builder flushInterval(int flushInterval)
      Set the time to wait at most (milliseconds).
      Parameters:
      flushInterval - the time to wait at most (milliseconds).
      Returns:
      this
    • jitterInterval

      @Nonnull public WriteOptions.Builder jitterInterval(int jitterInterval)
      Jitters the batch flush interval by a random amount. This is primarily to avoid large write spikes for users running a large number of client instances. ie, a jitter of 5s and flush duration 10s means flushes will happen every 10-15s.
      Parameters:
      jitterInterval - (milliseconds)
      Returns:
      this
    • retryInterval

      @Nonnull public WriteOptions.Builder retryInterval(int retryInterval)
      Set the the time to wait before retry unsuccessful write (milliseconds).

      The retry interval is used when the InfluxDB server does not specify "Retry-After" header.
      Retry-After: A non-negative decimal integer indicating the seconds to delay after the response is received.
      Parameters:
      retryInterval - the time to wait before retry unsuccessful write
      Returns:
      this
    • maxRetries

      @Nonnull public WriteOptions.Builder maxRetries(int maxRetries)
      The number of max retries when write fails.
      Parameters:
      maxRetries - number of max retries
      Returns:
      this
    • maxRetryDelay

      @Nonnull public WriteOptions.Builder maxRetryDelay(int maxRetryDelay)
      The maximum delay between each retry attempt in milliseconds.
      Parameters:
      maxRetryDelay - maximum delay
      Returns:
      this
    • maxRetryTime

      @Nonnull public WriteOptions.Builder maxRetryTime(int maxRetryTime)
      The maximum total retry timeout in milliseconds.
      Parameters:
      maxRetryTime - maximum timout
      Returns:
      this
    • exponentialBase

      @Nonnull public WriteOptions.Builder exponentialBase(int exponentialBase)
      The base for the exponential retry delay.
      Parameters:
      exponentialBase - exponential base
      Returns:
      this
    • bufferLimit

      @Nonnull public WriteOptions.Builder bufferLimit(int bufferLimit)
      The client maintains a buffer for failed writes so that the writes will be retried later on. This may help to overcome temporary network problems or InfluxDB load spikes. 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 retry buffer
      Returns:
      this
    • writeScheduler

      @Nonnull public WriteOptions.Builder writeScheduler(@Nonnull io.reactivex.rxjava3.core.Scheduler writeScheduler)
      Set the scheduler which is used for write data points. It is useful for disabling batch writes or for tuning the performance. Default value is Schedulers.newThread().
      Parameters:
      writeScheduler - the scheduler which is used for write data points.
      Returns:
      this
    • backpressureStrategy

      @Nonnull public WriteOptions.Builder backpressureStrategy(@Nonnull io.reactivex.rxjava3.core.BackpressureOverflowStrategy backpressureStrategy)
      Set the strategy to deal with buffer overflow when using onBackpressureBuffer.
      Parameters:
      backpressureStrategy - the strategy to deal with buffer overflow when using onBackpressureBuffer. Default BackpressureOverflowStrategy.DROP_OLDEST;
      Returns:
      this
    • build

      @Nonnull public WriteOptions build()
      Build an instance of WriteOptions.
      Returns:
      WriteOptions