@ThreadSafe public interface WriteApi extends AutoCloseable
The data are formatted in Line Protocol.
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.0via HTTP.
|
<T extends AbstractWriteEvent> |
listenEvents(Class<T> eventType,
EventListener<T> listener)
Listen the events produced by
WriteApi . |
<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(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(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(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(WritePrecision precision,
String record)
Write Line Protocol record 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 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 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 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 bucket<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 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@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 AutoCloseable
Copyright © 2018–2021 InfluxData, Inc.. All rights reserved.