These are chat archives for ReactiveX/RxJava

9th
Aug 2016
kimifdw
@kimifdw
Aug 09 2016 14:33
hello,I want to use rxjava to do some thing like java.util.concurrent.Future do(Future can return async result).I have no idea to do it
Dorus
@Dorus
Aug 09 2016 14:50
@kimifdw Rx.Observable.just(1,2,3).flatMap(e -> getDataA(e)).flatMap(a -> getDataB(a)) etc.
You just transform the stream each time with a new operator. flatMap takes an async function.
David Ray
@cogmission
Aug 09 2016 14:55
@kimifdw I'm going to attempt a "neophytes" answer to this: In a Nutshell you have two parts, the Observable and the Subscriber. The create of the Observable takes an Observable.OnSubscribe function that gets executed when a client subscribes. Put your functionality that gets executed by the "server" in that OnSubscribe function, and then return an Observable that when subscribed to will begin to be pushed executed results. If that helps? The asynchronous process executes in the OnSubscribe and then calls onNext(results) on the subscriber.