forked from influxdata/influxdb-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Jakub Bednář edited this page May 30, 2018
·
27 revisions
The reactive implementation should be solution for:
- Inconsistency in API
- Asynchronous API
- Performance improvement
There are several implementations of the Reactive Streams: RxJava, Reactor, Vert.x...
The Reactor was adopted into Spring 5.0 and it is foundation for the reactive modules in Spring, so reactive programming comes to the Spring:
- Spring WebFlux - Reactive REST
- Spring Data - Reactive data access
We can use the Retrofit RxJava adapter.
- Modern & Hype
- Performance
- Asynchronous
- Built in back pressure
- The reactive implementation needs a large library (RxJava - 2.2MB) => split java client into multimodule project (Maven BOM pattern)
package org.influxdb;
import javax.annotation.Nonnull;
import io.reactivex.Flowable;
import io.reactivex.Maybe;
import org.influxdb.dto.Point;
import org.reactivestreams.Publisher;
/**
* @author Jakub Bednar (bednar@github) (29/05/2018 14:58)
*/
public interface InfluxDBReactive
{
/**
* Write a single Point to the default database.
*
* @param point The point to write
*
* @return {@link Maybe} emitting the saved entity.
*/
Maybe<Point> write(@Nonnull Point point);
/**
* Saves all given entities.
*
* @param points The points to write
*
* @return {@link Flowable} emitting the saved entities.
*/
Flowable<Point> writeAll(@Nonnull Iterable<Point> points);
/**
* Saves all given entities.
*
* @param pointStream The stream of points to write
*
* @return {@link Flowable} emitting the saved entities.
*/
Flowable<Point> writeAll(@Nonnull Publisher<Point> pointStream);
}