public final class BatchOptions extends Object implements Cloneable
InfluxDB.enableBatch(BatchOptions)
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_BATCH_ACTIONS_LIMIT |
static int |
DEFAULT_BATCH_INTERVAL_DURATION |
static int |
DEFAULT_BUFFER_LIMIT |
static boolean |
DEFAULT_DROP_ACTIONS_ON_QUEUE_EXHAUSTION |
static int |
DEFAULT_JITTER_INTERVAL_DURATION |
static TimeUnit |
DEFAULT_PRECISION |
static BatchOptions |
DEFAULTS
Default batch options.
|
Modifier and Type | Method and Description |
---|---|
BatchOptions |
actions(int actions) |
BatchOptions |
bufferLimit(int bufferLimit)
The client maintains a buffer for failed writes so that the writes will be retried later on.
|
BatchOptions |
consistency(InfluxDB.ConsistencyLevel consistency) |
BatchOptions |
dropActionsOnQueueExhaustion(boolean dropActionsOnQueueExhaustion)
Set to define the behaviour when the action queue exhausts.
|
BatchOptions |
droppedActionHandler(Consumer<Point> droppedActionHandler)
Handler to handle dropped actions due to queue actions.
|
BatchOptions |
exceptionHandler(BiConsumer<Iterable<Point>,Throwable> exceptionHandler) |
BatchOptions |
flushDuration(int flushDuration) |
int |
getActions() |
int |
getBufferLimit() |
InfluxDB.ConsistencyLevel |
getConsistency() |
Consumer<Point> |
getDroppedActionHandler() |
BiConsumer<Iterable<Point>,Throwable> |
getExceptionHandler() |
int |
getFlushDuration() |
int |
getJitterDuration() |
TimeUnit |
getPrecision() |
ThreadFactory |
getThreadFactory() |
boolean |
isDropActionsOnQueueExhaustion() |
BatchOptions |
jitterDuration(int jitterDuration)
Jitters the batch flush interval by a random amount.
|
BatchOptions |
precision(TimeUnit precision)
Set the time precision to use for the whole batch.
|
BatchOptions |
threadFactory(ThreadFactory threadFactory) |
public static final int DEFAULT_BATCH_ACTIONS_LIMIT
public static final int DEFAULT_BATCH_INTERVAL_DURATION
public static final int DEFAULT_JITTER_INTERVAL_DURATION
public static final int DEFAULT_BUFFER_LIMIT
public static final TimeUnit DEFAULT_PRECISION
public static final boolean DEFAULT_DROP_ACTIONS_ON_QUEUE_EXHAUSTION
public static final BatchOptions DEFAULTS
public BatchOptions actions(int actions)
actions
- the number of actions to collectpublic BatchOptions flushDuration(int flushDuration)
flushDuration
- the time to wait at most (milliseconds).public BatchOptions jitterDuration(int jitterDuration)
jitterDuration
- (milliseconds)public BatchOptions bufferLimit(int bufferLimit)
getActions()
bufferLimit
- maximum number of points stored in the retry bufferpublic BatchOptions threadFactory(ThreadFactory threadFactory)
threadFactory
- a ThreadFactory instance to be usedpublic BatchOptions exceptionHandler(BiConsumer<Iterable<Point>,Throwable> exceptionHandler)
exceptionHandler
- a consumer function to handle asynchronous errorspublic BatchOptions consistency(InfluxDB.ConsistencyLevel consistency)
consistency
- cluster consistency setting (how many nodes have to store data points
to treat a write as a success)public BatchOptions precision(TimeUnit precision)
TimeUnit.NANOSECONDS
.precision
- sets the precision to usepublic BatchOptions dropActionsOnQueueExhaustion(boolean dropActionsOnQueueExhaustion)
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 be dropped and
droppedActionHandler
will be called.dropActionsOnQueueExhaustion
- sets the behaviorpublic BatchOptions droppedActionHandler(Consumer<Point> droppedActionHandler)
dropActionsOnQueueExhaustion
is set to true.droppedActionHandler
- to handle action drops on action queue exhaustion.public int getActions()
public int getFlushDuration()
public int getJitterDuration()
public int getBufferLimit()
bufferLimit(int)
public ThreadFactory getThreadFactory()
public BiConsumer<Iterable<Point>,Throwable> getExceptionHandler()
public InfluxDB.ConsistencyLevel getConsistency()
public TimeUnit getPrecision()
public boolean isDropActionsOnQueueExhaustion()
Copyright © 2022. All rights reserved.