@ThreadSafe public interface WriteApi extends AutoCloseable
The data are formatted in Line Protocol.
The WriteApi uses background thread to ingesting data into InfluxDB and is suppose to run as a singleton.
| Modifier and Type | Interface and Description |
|---|---|
static interface |
WriteApi.RetryOptions
Retry configuration.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close threads for asynchronous batch writing.
|
void |
flush()
Forces the client to flush all pending writes from the buffer toInfluxDB 2.x via HTTP.
|
<T extends AbstractWriteEvent> |
listenEvents(Class<T> eventType,
EventListener<T> listener)
Listen the events produced by
WriteApi. |
<M> void |
writeMeasurement(M measurement,
WriteParameters parameters)
Write Measurement into specified bucket.
|
<M> void |
writeMeasurement(String bucket,
String org,
WritePrecision precision,
M measurement)
Write Measurement into specified bucket.
|
<M> void |
writeMeasurement(WritePrecision precision,
M measurement)
Write Measurement into specified bucket.
|
<M> void |
writeMeasurements(List<M> measurements,
WriteParameters parameters)
Write Measurements into specified bucket.
|
<M> void |
writeMeasurements(String bucket,
String org,
WritePrecision precision,
List<M> measurements)
Write Measurements into specified bucket.
|
<M> void |
writeMeasurements(WritePrecision precision,
List<M> measurements)
Write Measurements into specified bucket.
|
void |
writePoint(Point point)
Write Data point into specified bucket.
|
void |
writePoint(Point point,
WriteParameters parameters)
Write Data point into specified bucket.
|
void |
writePoint(String bucket,
String org,
Point point)
Write Data point into specified bucket.
|
void |
writePoints(List<Point> points)
Write Data points into specified bucket.
|
void |
writePoints(List<Point> points,
WriteParameters parameters)
Write Data points into specified bucket.
|
void |
writePoints(String bucket,
String org,
List<Point> points)
Write Data points into specified bucket.
|
void |
writeRecord(String bucket,
String org,
WritePrecision precision,
String record)
Write Line Protocol record into specified bucket.
|
void |
writeRecord(String record,
WriteParameters parameters)
Write Line Protocol record into specified bucket.
|
void |
writeRecord(WritePrecision precision,
String record)
Write Line Protocol record into specified bucket.
|
void |
writeRecords(List<String> records,
WriteParameters parameters)
Write Line Protocol records into specified bucket.
|
void |
writeRecords(String bucket,
String org,
WritePrecision precision,
List<String> records)
Write Line Protocol records into specified bucket.
|
void |
writeRecords(WritePrecision precision,
List<String> records)
Write Line Protocol records into specified bucket.
|
void writeRecord(@Nonnull WritePrecision precision, @Nullable String record)
The InfluxDBClientOptions.getBucket() will be use as destination bucket
and InfluxDBClientOptions.getOrg() will be used as destination organization.
precision - specifies the precision for the unix timestamps within the body line-protocol (optional)record - specifies the record in InfluxDB Line Protocol.
The record is considered as one batch unit.void writeRecord(@Nonnull String bucket, @Nonnull String org, @Nonnull WritePrecision precision, @Nullable String record)
bucket - specifies the destination bucket for writesorg - specifies the destination organization for writesprecision - specifies the precision for the unix timestamps within the body line-protocol (optional)record - specifies the record in InfluxDB Line Protocol.
The record is considered as one batch unit.void writeRecord(@Nullable String record, @Nonnull WriteParameters parameters)
record - specifies the record in InfluxDB Line Protocol.
The record is considered as one batch unit.parameters - specify InfluxDB Write endpoint parametersvoid writeRecords(@Nonnull WritePrecision precision, @Nonnull List<String> records)
The InfluxDBClientOptions.getBucket() will be use as destination bucket
and InfluxDBClientOptions.getOrg() will be used as destination organization.
precision - specifies the precision for the unix timestamps within the body line-protocol (optional)records - specifies the records in InfluxDB Line Protocolvoid writeRecords(@Nonnull String bucket, @Nonnull String org, @Nonnull WritePrecision precision, @Nonnull List<String> records)
bucket - specifies the destination bucket for writesorg - specifies the destination organization for writesprecision - specifies the precision for the unix timestamps within the body line-protocol (optional)records - specifies the records in InfluxDB Line Protocolvoid writeRecords(@Nonnull List<String> records, @Nonnull WriteParameters parameters)
records - specifies the records in InfluxDB Line Protocolparameters - specify InfluxDB Write endpoint parametersvoid writePoint(@Nullable Point point)
The InfluxDBClientOptions.getBucket() will be use as destination bucket
and InfluxDBClientOptions.getOrg() will be used as destination organization.
point - specifies the Data point to write into bucketvoid writePoint(@Nonnull String bucket, @Nonnull String org, @Nullable Point point)
bucket - specifies the destination bucket for writesorg - specifies the destination organization for writespoint - specifies the Data point to write into bucketvoid writePoint(@Nullable Point point, @Nonnull WriteParameters parameters)
point - specifies the Data point to write into bucketparameters - specify InfluxDB Write endpoint parametersvoid writePoints(@Nonnull List<Point> points)
The InfluxDBClientOptions.getBucket() will be use as destination bucket
and InfluxDBClientOptions.getOrg() will be used as destination organization.
points - specifies the Data points to write into bucketvoid writePoints(@Nonnull String bucket, @Nonnull String org, @Nonnull List<Point> points)
bucket - specifies the destination bucket ID for writesorg - specifies the destination organization ID for writespoints - specifies the Data points to write into bucketvoid writePoints(@Nonnull List<Point> points, @Nonnull WriteParameters parameters)
points - specifies the Data points to write into bucketparameters - specify InfluxDB Write endpoint parameters<M> void writeMeasurement(@Nonnull WritePrecision precision, @Nullable M measurement)
The InfluxDBClientOptions.getBucket() will be use as destination bucket
and InfluxDBClientOptions.getOrg() will be used as destination organization.
M - measurement typeprecision - specifies the precision for the unix timestamps within the body line-protocol (optional)measurement - specifies the Measurement to write into bucket<M> void writeMeasurement(@Nonnull String bucket, @Nonnull String org, @Nonnull WritePrecision precision, @Nullable M measurement)
M - measurement typebucket - specifies the destination bucket for writesorg - specifies the destination organization for writesprecision - specifies the precision for the unix timestamps within the body line-protocol (optional)measurement - specifies the Measurement to write into bucket<M> void writeMeasurement(@Nullable M measurement, @Nonnull WriteParameters parameters)
M - measurement typemeasurement - specifies the Measurement to write into bucketparameters - specify InfluxDB Write endpoint parameters<M> void writeMeasurements(@Nonnull WritePrecision precision, @Nonnull List<M> measurements)
The InfluxDBClientOptions.getBucket() will be use as destination bucket
and InfluxDBClientOptions.getOrg() will be used as destination organization.
M - measurement typeprecision - specifies the precision for the unix timestamps within the body line-protocol (optional)measurements - specifies the Measurements to write into bucket<M> void writeMeasurements(@Nonnull String bucket, @Nonnull String org, @Nonnull WritePrecision precision, @Nonnull List<M> measurements)
M - measurement typebucket - specifies the destination bucket for writesorg - specifies the destination organization for writesprecision - specifies the precision for the unix timestamps within the body line-protocol (optional)measurements - specifies the Measurements to write into bucket<M> void writeMeasurements(@Nonnull List<M> measurements, @Nonnull WriteParameters parameters)
M - measurement typemeasurements - specifies the Measurements to write into bucketparameters - specify InfluxDB Write endpoint parameters@Nonnull <T extends AbstractWriteEvent> ListenerRegistration listenEvents(@Nonnull Class<T> eventType, @Nonnull EventListener<T> listener)
WriteApi.
The WriteApi produces: WriteSuccessEvent,
BackpressureEvent, WriteErrorEvent and WriteRetriableErrorEvent.
T - type of event to listeneventType - type of event to listenlistener - the listener to listen eventseventType eventsvoid flush()
void close()
close in interface AutoCloseableCopyright © 2018–2023 InfluxData, Inc.. All rights reserved.