0
votes

I have an org.reactivestreams.Processor that I would like use with RxJava 2.0. However, while there are conversions to integrate anorg.reactivestreams.Publisher with RxJava, like io.reactivex.Flowable#fromPublisher, it is not clear to me how to best integrate a org.reactivestreams.Processor (or org.reactivestreams.Subscriber). Can anyone shine some light on this?

1

1 Answers

0
votes

You wrap the Publisher side and keep the Subscriber side as is:

Processor proc = ...

Subscriber sub = proc;
Flowable flow = Flowable.fromPublisher(proc);

flow.map(v -> v.toString()).subscribe(System.out::println);

sub.onNext(1);