All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.influxdb.client.reactive.WriteReactiveApi Maven / Gradle / Ivy

Go to download

The reference reactive Java client for InfluxDB 2.x. The client provide supports for asynchronous stream processing with backpressure as is defined by the Reactive Streams.

There is a newer version: 7.2.0
Show newest version
/*
 * 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.reactive;

import javax.annotation.Nonnull;

import com.influxdb.client.InfluxDBClientOptions;
import com.influxdb.client.WriteApi;
import com.influxdb.client.domain.WritePrecision;
import com.influxdb.client.write.Point;
import com.influxdb.client.write.events.AbstractWriteEvent;
import com.influxdb.client.write.events.BackpressureEvent;
import com.influxdb.client.write.events.WriteErrorEvent;
import com.influxdb.client.write.events.WriteRetriableErrorEvent;
import com.influxdb.client.write.events.WriteSuccessEvent;

import io.reactivex.Flowable;
import io.reactivex.Maybe;
import io.reactivex.Observable;
import org.reactivestreams.Publisher;

/**
 * Write time-series data into InfluxDB 2.0.
 * 

* The data are formatted in Line Protocol. * * @author Jakub Bednar (bednar@github) (22/11/2018 06:49) */ public interface WriteReactiveApi extends AutoCloseable { /** * 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. *

* * @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. */ void writeRecord(@Nonnull final WritePrecision precision, @Nonnull final Maybe record); /** * Write Line Protocol record into specified bucket. * * @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. */ void writeRecord(@Nonnull final String bucket, @Nonnull final String org, @Nonnull final WritePrecision precision, @Nonnull final Maybe record); /** * 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. *

* * @param precision specifies the precision for the unix timestamps within the body line-protocol (optional) * @param records specifies the records in InfluxDB Line Protocol */ void writeRecords(@Nonnull final WritePrecision precision, @Nonnull final Flowable records); /** * Write Line Protocol records into specified bucket. * * @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 */ void writeRecords(@Nonnull final String bucket, @Nonnull final String org, @Nonnull final WritePrecision precision, @Nonnull final Flowable records); /** * 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. *

* * @param precision specifies the precision for the unix timestamps within the body line-protocol (optional) * @param records specifies the records in InfluxDB Line Protocol */ void writeRecords(@Nonnull final WritePrecision precision, @Nonnull final Publisher records); /** * Write Line Protocol records into specified bucket. * * @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 */ void writeRecords(@Nonnull final String bucket, @Nonnull final String org, @Nonnull final WritePrecision precision, @Nonnull final Publisher records); /** * 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. *

* * @param point specifies the Data point to write into bucket */ void writePoint(@Nonnull final Maybe point); /** * Write Data point into specified bucket. * * @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 */ void writePoint(@Nonnull final String bucket, @Nonnull final String org, @Nonnull final Maybe point); /** * 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. *

* * * @param points specifies the Data points to write into bucket */ void writePoints(@Nonnull final Flowable points); /** * Write Data points into specified bucket. * * @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 */ void writePoints(@Nonnull final String bucket, @Nonnull final String org, @Nonnull final Flowable points); /** * 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. *

* * @param points specifies the Data points to write into bucket */ void writePoints(@Nonnull final Publisher points); /** * Write Data points into specified bucket. * * @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 */ void writePoints(@Nonnull final String bucket, @Nonnull final String org, @Nonnull final Publisher points); /** * 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. *

* * @param precision specifies the precision for the unix timestamps within the body line-protocol (optional) * @param measurement specifies the Measurement to write into bucket * @param type of measurement */ void writeMeasurement(@Nonnull final WritePrecision precision, @Nonnull final Maybe measurement); /** * Write Measurement into specified bucket. * * @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 specifies the Measurement to write into bucket * @param type of measurement */ void writeMeasurement(@Nonnull final String bucket, @Nonnull final String org, @Nonnull final WritePrecision precision, @Nonnull final Maybe measurement); /** * 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. *

* * @param precision specifies the precision for the unix timestamps within the body line-protocol (optional) * @param measurements specifies the Measurements to write into bucket * @param type of measurement */ void writeMeasurements(@Nonnull final WritePrecision precision, @Nonnull final Flowable measurements); /** * Write Measurements into specified bucket. * * @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 measurements specifies the Measurements to write into bucket * @param type of measurement */ void writeMeasurements(@Nonnull final String bucket, @Nonnull final String org, @Nonnull final WritePrecision precision, @Nonnull final Flowable measurements); /** * 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. *

* * @param precision specifies the precision for the unix timestamps within the body line-protocol (optional) * @param measurements specifies the Measurements to write into bucket * @param type of measurement */ void writeMeasurements(@Nonnull final WritePrecision precision, @Nonnull final Publisher measurements); /** * Write Measurements into specified bucket. * * @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 measurements specifies the Measurements to write into bucket * @param type of measurement */ void writeMeasurements(@Nonnull final String bucket, @Nonnull final String org, @Nonnull final WritePrecision precision, @Nonnull final Publisher measurements); /** * Listen the events produced by {@link WriteApi}. *

* The {@link WriteApi} produces: {@link WriteSuccessEvent}, * {@link BackpressureEvent}, {@link WriteErrorEvent} and {@link WriteRetriableErrorEvent}. * * @param eventType type of event to listen * @param type of event to listen * @return lister for {@code eventType} events */ @Nonnull Observable listenEvents(@Nonnull final Class eventType); /** * Close threads for asynchronous batch writing. */ void close(); }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy