4. Reactive Streams
“Reactive Streams is an initiative to provide a standard for asynchronous
stream processing with non-blocking back pressure. This encompasses efforts
aimed at runtime environments (JVM and JavaScript) as well as network
protocols.”
5. Reactive Streams
public interface Publisher<T> {
public void subscribe(Subscriber<? super T> s);
}
public interface Subscriber< T> {
public void onSubscribe (Subscription s) ;
public void onNext(T t);
public void onError(Throwable t) ;
public void onComplete();
}
6. Reactive Streams
public interface Subscription {
public void request(long n);
public void cancel();
}
public interface Processor<T, R> extends Subscriber<T>, Publisher<R> {
}
7. Observable types
Type Description
Flowable<T> Emits 0 or n items and terminates with complete or an
error. Supports backpressure, which allows to control
how fast a source emits items.
Observable<T> Emits 0 or n items and terminates with complete or an
error.
Single<T> Emits either a single item or an error. The reactive
version of a method call. You subscribe to a Single and
you get either a return value or an error.
Maybe<T> Succeeds with an item, or no item, or errors. The
reactive version of an Optional.
Completable Either completes or returns an error. It never return
items. The reactive version of a Runnable.
18. Libraries compatibility
● Retrofit READY
● Realm NOT
● Requery READY
● SugarOrm NOT
● Ormlite NOT
● GreenDao NOT
● Firebase NOT (wrapper libraries)
● SqlBrite NOT