Package com.influxdb.client
Class WriteOptions.Builder
java.lang.Object
com.influxdb.client.WriteOptions.Builder
- Enclosing class:
WriteOptions
A builder for
WriteOptions.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbackpressureStrategy(io.reactivex.rxjava3.core.BackpressureOverflowStrategy backpressureStrategy) Set the strategy to deal with buffer overflow when using onBackpressureBuffer.batchSize(int batchSize) Set the number of data point to collect in batch.bufferLimit(int bufferLimit) The client maintains a buffer for failed writes so that the writes will be retried later on.build()Build an instance of WriteOptions.captureBackpressureData(boolean captureBackpressureData) Set whether to capture affected data points in backpressure events.concatMapPrefetch(int concatMapPrefetch) Set the prefetch value for the concatMapMaybe operator that processes write batches.exponentialBase(int exponentialBase) The base for the exponential retry delay.flushInterval(int flushInterval) Set the time to wait at most (milliseconds).jitterInterval(int jitterInterval) Jitters the batch flush interval by a random amount.maxRetries(int maxRetries) The number of max retries when write fails.maxRetryDelay(int maxRetryDelay) The maximum delay between each retry attempt in milliseconds.maxRetryTime(int maxRetryTime) The maximum total retry timeout in milliseconds.retryInterval(int retryInterval) Set the the time to wait before retry unsuccessful write (milliseconds).writeScheduler(io.reactivex.rxjava3.core.Scheduler writeScheduler) Set the scheduler which is used for write data points.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
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
Set the time to wait at most (milliseconds).- Parameters:
flushInterval- the time to wait at most (milliseconds).- Returns:
this
-
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
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
The number of max retries when write fails.- Parameters:
maxRetries- number of max retries- Returns:
this
-
maxRetryDelay
The maximum delay between each retry attempt in milliseconds.- Parameters:
maxRetryDelay- maximum delay- Returns:
this
-
maxRetryTime
The maximum total retry timeout in milliseconds.- Parameters:
maxRetryTime- maximum timout- Returns:
this
-
exponentialBase
The base for the exponential retry delay.- Parameters:
exponentialBase- exponential base- Returns:
this
-
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
-
concatMapPrefetch
Set the prefetch value for the concatMapMaybe operator that processes write batches. The number of upstream items to prefetch so that fresh items are ready to be mapped when a previous MaybeSource terminates.- Parameters:
concatMapPrefetch- the prefetch value for concatMapMaybe operator (must be positive)- 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 isSchedulers.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. DefaultBackpressureOverflowStrategy.DROP_OLDEST;- Returns:
this
-
captureBackpressureData
Set whether to capture affected data points in backpressure events. When enabled, BackpressureEvent will include the specific line protocol points that are affected by the backpressure condition: - For DROP_OLDEST strategy: points that will be dropped - For DROP_LATEST strategy: newest points being added Disabling this can improve performance when backpressure data capture is not needed.- Parameters:
captureBackpressureData- whether to capture affected data points. Default is false.- Returns:
this
-
build
Build an instance of WriteOptions.- Returns:
WriteOptions
-