So you have heard about RxJava, maybe checked out some articles, videos or even code - but things are still not that clear!? The aim of this talk is first of all to create the functional reactive programming mindset; to explain what an Observable and a Subscriber are; and to give a bit of insight in the magic of thread handling in RxJava.
We will then take a practical example, see how RxJava can be applied and what its advantages are compared to other options.
I will end the talk by addressing an important question: how to best proceed to integrate RxJava into an existing app.
68. @FMuntenescu
public Burger cook(){
// cooking is time consuming
// make sure it’s on a background thread
return burger;
}
Observable<Burger> burgerObservable =
Observable.fromCallable(this::cook)
.subscribeOn(Schedulers.computation())
.observeOn(AndroidSchedulers.mainThread())
71. @FMuntenescu@FMuntenescu
jobs@updudes.net
Building a Reactive Mindset
https://upday.github.io/blog/reactive_mindset_burgers
Reactive Burgers – Code Example
https://github.com/florina-muntenescu/ReactiveBurgers
Building a
Burger
Reactive
Mindset
Editor's Notes
In ReactiveX, you're not pulling values - you're not telling Paco to give you a bun!
but you get values pushed – Paco gives you buns and then you act on the emissions of that stream.
For example, when we need to filter the meat that has gone bad, we don't have an for(meat: meatBunch)
but rather, we say that from this stream of meat balls we only want those that are good. We shouldn't received the meat that has gone bad.
The concepts are still the same - streams of data that are fairly easy to manipulate and to compose, at the same time, being able to handle the working threads.