
com.influxdb.client.WriteApiBlocking Maven / Gradle / Ivy
/*
* The MIT License
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.influxdb.client;
import java.util.List;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import javax.annotation.concurrent.ThreadSafe;
import com.influxdb.client.domain.WritePrecision;
import com.influxdb.client.write.Point;
import com.influxdb.client.write.WriteParameters;
import com.influxdb.exceptions.InfluxException;
/**
* The synchronous blocking API to Write time-series data into InfluxDB 2.x.
*
* The data are formatted in Line Protocol.
*
*
* @author Jakub Bednar (bednar@github) (20/09/2018 10:58)
*/
@ThreadSafe
public interface WriteApiBlocking {
/**
* Write Line Protocol record into specified bucket.
*
*
* The {@link InfluxDBClientOptions#getBucket()} will be use as destination bucket
* and {@link InfluxDBClientOptions#getOrg()} will be used as destination organization.
*
*
*
* NOTE: This method directly write data info InfluxDB 2.x without batching, jittering and backpressure.
* The method blocks the executing thread until their operation finished.
* There is also non-blocking alternative {@link WriteApi#writeRecord(WritePrecision, String)}.
*
*
* @param precision specifies the precision for the unix timestamps within the body line-protocol (optional)
* @param record specifies the record in InfluxDB Line Protocol.
* The {@code record} is considered as one batch unit.
* @throws InfluxException if a problem occurred during write time-series data into InfluxDB
*/
void writeRecord(@Nonnull final WritePrecision precision,
@Nullable final String record) throws InfluxException;
/**
* Write Line Protocol record into specified bucket.
*
*
* NOTE: This method directly write data info InfluxDB 2.x without batching, jittering and backpressure.
* The method blocks the executing thread until their operation finished.
* There is also non-blocking alternative {@link WriteApi#writeRecords(String, String, WritePrecision, List)}.
*
*
* @param bucket specifies the destination bucket for writes
* @param org specifies the destination organization for writes
* @param precision specifies the precision for the unix timestamps within the body line-protocol (optional)
* @param record specifies the record in InfluxDB Line Protocol.
* The {@code record} is considered as one batch unit.
* @throws InfluxException if a problem occurred during write time-series data into InfluxDB
*/
void writeRecord(@Nonnull final String bucket,
@Nonnull final String org,
@Nonnull final WritePrecision precision,
@Nullable final String record) throws InfluxException;
/**
* Write Line Protocol record into specified bucket.
*
*
* NOTE: This method directly write data info InfluxDB 2.x without batching, jittering and backpressure.
* The method blocks the executing thread until their operation finished.
* There is also non-blocking alternative {@link WriteApi#writeRecord(String, WriteParameters)}.
*
*
* @param record specifies the record in InfluxDB Line Protocol.
* The {@code record} is considered as one batch unit.
* @param parameters specify InfluxDB Write endpoint parameters
* @throws InfluxException if a problem occurred during write time-series data into InfluxDB
*/
void writeRecord(@Nullable final String record, @Nonnull final WriteParameters parameters) throws InfluxException;
/**
* Write Line Protocol records into specified bucket.
*
*
* The {@link InfluxDBClientOptions#getBucket()} will be use as destination bucket
* and {@link InfluxDBClientOptions#getOrg()} will be used as destination organization.
*
*
*
* NOTE: This method directly write data info InfluxDB 2.x without batching, jittering and backpressure.
* The method blocks the executing thread until their operation finished.
* There is also non-blocking alternative {@link WriteApi#writeRecords(WritePrecision, List)}.
*
*
* @param precision specifies the precision for the unix timestamps within the body line-protocol (optional)
* @param records specifies the records in InfluxDB Line Protocol
* @throws InfluxException if a problem occurred during write time-series data into InfluxDB
*/
void writeRecords(@Nonnull final WritePrecision precision,
@Nonnull final List records) throws InfluxException;
/**
* Write Line Protocol records into specified bucket.
*
*
* NOTE: This method directly write data info InfluxDB 2.x without batching, jittering and backpressure.
* The method blocks the executing thread until their operation finished.
* There is also non-blocking alternative {@link WriteApi#writeRecords(String, String, WritePrecision, List)}.
*
*
* @param bucket specifies the destination bucket for writes
* @param org specifies the destination organization for writes
* @param precision specifies the precision for the unix timestamps within the body line-protocol (optional)
* @param records specifies the records in InfluxDB Line Protocol
* @throws InfluxException if a problem occurred during write time-series data into InfluxDB
*/
void writeRecords(@Nonnull final String bucket,
@Nonnull final String org,
@Nonnull final WritePrecision precision,
@Nonnull final List records) throws InfluxException;
/**
* Write Line Protocol records into specified bucket.
*
*
* NOTE: This method directly write data info InfluxDB 2.x without batching, jittering and backpressure.
* The method blocks the executing thread until their operation finished.
* There is also non-blocking alternative {@link WriteApi#writeRecords(List, WriteParameters)}.
*
*
* @param records specifies the records in InfluxDB Line Protocol
* @param parameters specify InfluxDB Write endpoint parameters
* @throws InfluxException if a problem occurred during write time-series data into InfluxDB
*/
void writeRecords(@Nonnull final List records, @Nonnull final WriteParameters parameters)
throws InfluxException;
/**
* Write Data point into specified bucket.
*
*
* The {@link InfluxDBClientOptions#getBucket()} will be use as destination bucket
* and {@link InfluxDBClientOptions#getOrg()} will be used as destination organization.
*
*
*
* NOTE: This method directly write data info InfluxDB 2.x without batching, jittering and backpressure.
* The method blocks the executing thread until their operation finished.
* There is also non-blocking alternative {@link WriteApi#writePoint(Point)}.
*
*
* @param point specifies the Data point to write into bucket
* @throws InfluxException if a problem occurred during write time-series data into InfluxDB
*/
void writePoint(@Nullable final Point point) throws InfluxException;
/**
* Write Data point into specified bucket.
*
*
* NOTE: This method directly write data info InfluxDB 2.x without batching, jittering and backpressure.
* The method blocks the executing thread until their operation finished.
* There is also non-blocking alternative {@link WriteApi#writePoint(String, String, Point)}.
*
*
* @param bucket specifies the destination bucket for writes
* @param org specifies the destination organization for writes
* @param point specifies the Data point to write into bucket
* @throws InfluxException if a problem occurred during write time-series data into InfluxDB
*/
void writePoint(@Nonnull final String bucket,
@Nonnull final String org,
@Nullable final Point point) throws InfluxException;
/**
* Write Data point into specified bucket.
*
*
* NOTE: This method directly write data info InfluxDB 2.x without batching, jittering and backpressure.
* The method blocks the executing thread until their operation finished.
* There is also non-blocking alternative {@link WriteApi#writePoint(Point, WriteParameters)}.
*
*
* @param point specifies the Data point to write into bucket
* @param parameters specify InfluxDB Write endpoint parameters
* @throws InfluxException if a problem occurred during write time-series data into InfluxDB
*/
void writePoint(@Nullable final Point point, @Nonnull final WriteParameters parameters) throws InfluxException;
/**
* Write Data points into specified bucket.
*
*
* The {@link InfluxDBClientOptions#getBucket()} will be use as destination bucket
* and {@link InfluxDBClientOptions#getOrg()} will be used as destination organization.
*
*
*
* NOTE: This method directly write data info InfluxDB 2.x without batching, jittering and backpressure.
* The method blocks the executing thread until their operation finished.
* There is also non-blocking alternative {@link WriteApi#writePoints(List)}.
*
*
* @param points specifies the Data points to write into bucket
* @throws InfluxException if a problem occurred during write time-series data into InfluxDB
*/
void writePoints(@Nonnull final List points) throws InfluxException;
/**
* Write Data points into specified bucket.
*
*
* NOTE: This method directly write data info InfluxDB 2.x without batching, jittering and backpressure.
* The method blocks the executing thread until their operation finished.
* There is also non-blocking alternative {@link WriteApi#writePoints(String, String, List)}.
*
*
* @param bucket specifies the destination bucket ID for writes
* @param org specifies the destination organization ID for writes
* @param points specifies the Data points to write into bucket
* @throws InfluxException if a problem occurred during write time-series data into InfluxDB
*/
void writePoints(@Nonnull final String bucket,
@Nonnull final String org,
@Nonnull final List points) throws InfluxException;
/**
* Write Data points into specified bucket.
*
*
* NOTE: This method directly write data info InfluxDB 2.x without batching, jittering and backpressure.
* The method blocks the executing thread until their operation finished.
* There is also non-blocking alternative {@link WriteApi#writePoints(List, WriteParameters)}.
*
*
* @param points specifies the Data points to write into bucket
* @param parameters specify InfluxDB Write endpoint parameters
* @throws InfluxException if a problem occurred during write time-series data into InfluxDB
*/
void writePoints(@Nonnull final List points, @Nonnull final WriteParameters parameters)
throws InfluxException;
/**
* Write Measurement into specified bucket.
*
*
* The {@link InfluxDBClientOptions#getBucket()} will be use as destination bucket
* and {@link InfluxDBClientOptions#getOrg()} will be used as destination organization.
*
*
*
* NOTE: This method directly write data info InfluxDB 2.x without batching, jittering and backpressure.
* The method blocks the executing thread until their operation finished.
* There is also non-blocking alternative {@link WriteApi#writeMeasurement(WritePrecision, Object)}.
*
*
* @param precision specifies the precision for the unix timestamps within the body line-protocol (optional)
* @param measurement type
* @param measurement specifies the Measurement to write into bucket
* @throws InfluxException if a problem occurred during write time-series data into InfluxDB
*/
void writeMeasurement(@Nonnull final WritePrecision precision,
@Nullable final M measurement) throws InfluxException;
/**
* Write Measurement into specified bucket.
*
*
* NOTE: This method directly write data info InfluxDB 2.x without batching, jittering and backpressure.
* The method blocks the executing thread until their operation finished.
* There is also non-blocking alternative {@link WriteApi#writeMeasurement(String, String, WritePrecision, Object)}.
*
*
* @param bucket specifies the destination bucket for writes
* @param org specifies the destination organization for writes
* @param precision specifies the precision for the unix timestamps within the body line-protocol (optional)
* @param measurement type
* @param measurement specifies the Measurement to write into bucket
* @throws InfluxException if a problem occurred during write time-series data into InfluxDB
*/
void writeMeasurement(@Nonnull final String bucket,
@Nonnull final String org,
@Nonnull final WritePrecision precision,
@Nullable final M measurement) throws InfluxException;
/**
* Write Measurement into specified bucket.
*
*
* NOTE: This method directly write data info InfluxDB 2.x without batching, jittering and backpressure.
* The method blocks the executing thread until their operation finished.
* There is also non-blocking alternative {@link WriteApi#writeMeasurement(Object, WriteParameters)}.
*
*
* @param measurement type
* @param measurement specifies the Measurement to write into bucket
* @param parameters specify InfluxDB Write endpoint parameters
* @throws InfluxException if a problem occurred during write time-series data into InfluxDB
*/
void writeMeasurement(@Nullable final M measurement, @Nonnull final WriteParameters parameters)
throws InfluxException;
/**
* Write Measurements into specified bucket.
*
*
* The {@link InfluxDBClientOptions#getBucket()} will be use as destination bucket
* and {@link InfluxDBClientOptions#getOrg()} will be used as destination organization.
*
*
*
* NOTE: This method directly write data info InfluxDB 2.x without batching, jittering and backpressure.
* The method blocks the executing thread until their operation finished.
* There is also non-blocking alternative {@link WriteApi#writeMeasurements(WritePrecision, List)}.
*
*
* @param precision specifies the precision for the unix timestamps within the body line-protocol (optional)
* @param measurement type
* @param measurements specifies the Measurements to write into bucket
* @throws InfluxException if a problem occurred during write time-series data into InfluxDB
*/
void writeMeasurements(@Nonnull final WritePrecision precision,
@Nonnull final List measurements) throws InfluxException;
/**
* Write Measurements into specified bucket.
*
*
* NOTE: This method directly write data info InfluxDB 2.x without batching, jittering and backpressure.
* The method blocks the executing thread until their operation finished.
* There is also non-blocking alternative {@link WriteApi#writeMeasurements(String, String, WritePrecision, List)}.
*
*
* @param bucket specifies the destination bucket for writes
* @param org specifies the destination organization for writes
* @param precision specifies the precision for the unix timestamps within the body line-protocol (optional)
* @param measurement type
* @param measurements specifies the Measurements to write into bucket
* @throws InfluxException if a problem occurred during write time-series data into InfluxDB
*/
void writeMeasurements(@Nonnull final String bucket,
@Nonnull final String org,
@Nonnull final WritePrecision precision,
@Nonnull final List measurements) throws InfluxException;
/**
* Write Measurements into specified bucket.
*
*
* NOTE: This method directly write data info InfluxDB 2.x without batching, jittering and backpressure.
* The method blocks the executing thread until their operation finished.
* There is also non-blocking alternative {@link WriteApi#writeMeasurements(List, WriteParameters)}.
*
*
* @param measurement type
* @param measurements specifies the Measurements to write into bucket
* @param parameters specify InfluxDB Write endpoint parameters
* @throws InfluxException if a problem occurred during write time-series data into InfluxDB
*/
void writeMeasurements(@Nonnull final List measurements, @Nonnull final WriteParameters parameters)
throws InfluxException;
}