Advanced Topics in Concurrency and Reactive Programming Majeed Kassis
The Marble Diagram This style of diagram is useful to illustrate the behavior we wish to achieve using ReactiveX. See http://rxmarbles.com/
Map Operation
Map Example
Filter Operation
Filter Example
Merge Operation http://rxmarbles.com/#merge
Merge Example 1 2 3 4 5 6 7 8 9 private void mergeExample() { final String[] aStrings = {"A1", "A2", "A3", "A4"}; final String[] bStrings = {"B1", "B2", "B3"}; final Observable<String> aObservable = Observable.fromArray(aStrings); final Observable<String> bObservable = Observable.fromArray(bStrings); Observable.merge(aObservable, bObservable) .subscribe(getObserver()); }
Combining via Zip http://rxmarbles.com/#zip
Error Handling: onErrorResumeNext The onErrorResumeNext method returns an Observable that mirrors the behavior of the source Observable, unless that Observable invokes onError in which case, rather than propagating that error to the observer, onErrorResumeNext will instead begin mirroring a second, backup Observable.
Error Handling: onErrorReturn
OnErrorReturn (something) Example