Package com.influxdb.client
Class WriteOptions.Builder
java.lang.Object
com.influxdb.client.WriteOptions.Builder
- Enclosing class:
WriteOptions
A builder for
WriteOptions
.-
Constructor Summary
-
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.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
-
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
-
build
Build an instance of WriteOptions.- Returns:
WriteOptions
-