RxJava 2.0 - How to Convert Observable to Publisher

How to convert Observable to Publisher in RxJava version 2?

In the first version, we have a project https://github.com/ReactiveX/RxJavaReactiveStreams , which does exactly what I need. But how can I do this in RxJava 2?

+8
java reactive-programming rx-java2 reactivex reactive-streams
source share
1 answer

Use the following code:

Publisher publisher = observable.toFlowable(BackpressureStrategy.XXX); 

Since Observable does not implement backpressure, you need to choose a backpressure strategy for conversion. See Available Options here .

Or use Flowable instead of Observable first. See here for more details.

+11
source share

All Articles