我想要一个org.reactivestreams.Processor
,我想用RxJava 2.0。但是,虽然有一些转换要将org.reactivestreams.Publisher
与RxJava集成,例如io.reactivex.Flowable#fromPublisher
,但我不清楚如何最好地整合org.reactivestreams.Processor
(或org.reactivestreams.Subscriber
)。任何人都可以对此有所启发吗?
答案 0 :(得分:0)
您打包Publisher
并保持Subscriber
面不变:
Processor proc = ...
Subscriber sub = proc;
Flowable flow = Flowable.fromPublisher(proc);
flow.map(v -> v.toString()).subscribe(System.out::println);
sub.onNext(1);