Interface WriteApi
- All Superinterfaces:
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.
- Author:
- Jakub Bednar (bednar@github) (20/09/2018 10:58)
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
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>
ListenerRegistrationlistenEvents
(Class<T> eventType, EventListener<T> listener) Listen the events produced byWriteApi
.<M> void
writeMeasurement
(WritePrecision precision, M measurement) Write Measurement into specified bucket.<M> void
writeMeasurement
(String bucket, String org, WritePrecision precision, M measurement) Write Measurement into specified bucket.<M> void
writeMeasurement
(M measurement, WriteParameters parameters) Write Measurement into specified bucket.<M> void
writeMeasurements
(WritePrecision precision, List<M> measurements) 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
(List<M> measurements, WriteParameters parameters) 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
(String bucket, String org, List<Point> points) Write Data points 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
writeRecord
(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
(String bucket, String org, WritePrecision precision, String record) Write Line Protocol record into specified bucket.void
writeRecords
(WritePrecision precision, List<String> records) 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
(List<String> records, WriteParameters parameters) Write Line Protocol records into specified bucket.
-
Method Details
-
writeRecord
Write Line Protocol record into specified bucket.The
InfluxDBClientOptions.getBucket()
will be use as destination bucket andInfluxDBClientOptions.getOrg()
will be used as destination organization.- Parameters:
precision
- specifies the precision for the unix timestamps within the body line-protocol (optional)record
- specifies the record in InfluxDB Line Protocol. Therecord
is considered as one batch unit.
-
writeRecord
void writeRecord(@Nonnull String bucket, @Nonnull String org, @Nonnull WritePrecision precision, @Nullable String record) Write Line Protocol record into specified bucket.- Parameters:
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. Therecord
is considered as one batch unit.
-
writeRecord
Write Line Protocol record into specified bucket.- Parameters:
record
- specifies the record in InfluxDB Line Protocol. Therecord
is considered as one batch unit.parameters
- specify InfluxDB Write endpoint parameters
-
writeRecords
Write Line Protocol records into specified bucket.The
InfluxDBClientOptions.getBucket()
will be use as destination bucket andInfluxDBClientOptions.getOrg()
will be used as destination organization.- Parameters:
precision
- specifies the precision for the unix timestamps within the body line-protocol (optional)records
- specifies the records in InfluxDB Line Protocol
-
writeRecords
void writeRecords(@Nonnull String bucket, @Nonnull String org, @Nonnull WritePrecision precision, @Nonnull List<String> records) Write Line Protocol records into specified bucket.- Parameters:
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 Protocol
-
writeRecords
Write Line Protocol records into specified bucket.- Parameters:
records
- specifies the records in InfluxDB Line Protocolparameters
- specify InfluxDB Write endpoint parameters
-
writePoint
Write Data point into specified bucket.The
InfluxDBClientOptions.getBucket()
will be use as destination bucket andInfluxDBClientOptions.getOrg()
will be used as destination organization.- Parameters:
point
- specifies the Data point to write into bucket
-
writePoint
Write Data point into specified bucket.- Parameters:
bucket
- specifies the destination bucket for writesorg
- specifies the destination organization for writespoint
- specifies the Data point to write into bucket
-
writePoint
Write Data point into specified bucket.- Parameters:
point
- specifies the Data point to write into bucketparameters
- specify InfluxDB Write endpoint parameters
-
writePoints
Write Data points into specified bucket.The
InfluxDBClientOptions.getBucket()
will be use as destination bucket andInfluxDBClientOptions.getOrg()
will be used as destination organization.- Parameters:
points
- specifies the Data points to write into bucket
-
writePoints
Write Data points into specified bucket.- Parameters:
bucket
- specifies the destination bucket ID for writesorg
- specifies the destination organization ID for writespoints
- specifies the Data points to write into bucket
-
writePoints
Write Data points into specified bucket.- Parameters:
points
- specifies the Data points to write into bucketparameters
- specify InfluxDB Write endpoint parameters
-
writeMeasurement
Write Measurement into specified bucket.The
InfluxDBClientOptions.getBucket()
will be use as destination bucket andInfluxDBClientOptions.getOrg()
will be used as destination organization.- Type Parameters:
M
- measurement type- Parameters:
precision
- specifies the precision for the unix timestamps within the body line-protocol (optional)measurement
- specifies the Measurement to write into bucket
-
writeMeasurement
<M> void writeMeasurement(@Nonnull String bucket, @Nonnull String org, @Nonnull WritePrecision precision, @Nullable M measurement) Write Measurement into specified bucket.- Type Parameters:
M
- measurement type- Parameters:
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)measurement
- specifies the Measurement to write into bucket
-
writeMeasurement
Write Measurement into specified bucket.- Type Parameters:
M
- measurement type- Parameters:
measurement
- specifies the Measurement to write into bucketparameters
- specify InfluxDB Write endpoint parameters
-
writeMeasurements
Write Measurements into specified bucket.The
InfluxDBClientOptions.getBucket()
will be use as destination bucket andInfluxDBClientOptions.getOrg()
will be used as destination organization.- Type Parameters:
M
- measurement type- Parameters:
precision
- specifies the precision for the unix timestamps within the body line-protocol (optional)measurements
- specifies the Measurements to write into bucket
-
writeMeasurements
<M> void writeMeasurements(@Nonnull String bucket, @Nonnull String org, @Nonnull WritePrecision precision, @Nonnull List<M> measurements) Write Measurements into specified bucket.- Type Parameters:
M
- measurement type- Parameters:
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)measurements
- specifies the Measurements to write into bucket
-
writeMeasurements
Write Measurements into specified bucket.- Type Parameters:
M
- measurement type- Parameters:
measurements
- specifies the Measurements to write into bucketparameters
- specify InfluxDB Write endpoint parameters
-
listenEvents
@Nonnull <T extends AbstractWriteEvent> ListenerRegistration listenEvents(@Nonnull Class<T> eventType, @Nonnull EventListener<T> listener) Listen the events produced byWriteApi
.The
WriteApi
produces:WriteSuccessEvent
,BackpressureEvent
,WriteErrorEvent
andWriteRetriableErrorEvent
.- Type Parameters:
T
- type of event to listen- Parameters:
eventType
- type of event to listenlistener
- the listener to listen events- Returns:
- lister for
eventType
events
-
flush
void flush()Forces the client to flush all pending writes from the buffer toInfluxDB 2.x via HTTP. -
close
void close()Close threads for asynchronous batch writing.- Specified by:
close
in interfaceAutoCloseable
-