Upgrade to Pro — share decks privately, control downloads, hide ads and more …

HumanTalks - Rx(Java)

HumanTalks - Rx(Java)

Short presentation about RxExtensions / RxJava

ctranxuan

April 12, 2016
Tweet

More Decks by ctranxuan

Other Decks in Programming

Transcript

  1. What? What? single item multiple items synchronous Object Iterable asynchronous

    Future Observable Observable Observable Observer / Observer / Subscriber Subscriber Subscription Subscription
  2. Operators Operators Observable<String> titles = VideoService.getVideos(userId) // Observable<Video> .filter(video ->

    "Sci-Fi".equals(video.getTheme())) .take(10) .map(video -> video.getTitle()); Subscription<String> subscription = titles.subscribe( (title) -> System.out::println, (error) -> System.err::println, () -> System.out.println("That's the end, folks!") ); filter(...) map(...) take(...)
  3. Operators Operators Creation: Creation: create(), from(),just(), interval(), etc. Transfor- Transfor-

    mation: mation: map(), flatmap(),grou pBy(), window(), etc. Filtering: Filtering: filter(), debounce(), take(), skip(), etc.
  4. References References ReactiveX.io: Reactive Streams: Akka Streams: ProjectReactor.io: RxJavaPosts :

    Advanced RxJava: http://reactivex.io/ http://www.reactive-streams.org/ http://doc.akka.io/docs/akka/2.4.3/scala/stream/index.html http://projectreactor.io/ http://tomstechnicalblog.blogspot.fr/ http://akarnokd.blogspot.fr/
  5. References References Cold Observable versus a Hot Observable is by

    Nickolay Tsvetinov, author ofLearning Reactive Programming with Java 8 We can say that cold Observables generate notifications for each subscriber and hot Observables are always running, broadcasting notifications to all of their subscribers. Think of a hot Observable as a radio station. All of the listeners that are listening to it at this moment listen to the same song. A cold Observable is a music CD. Many people can buy it and listen to it independently. http://tomstechnicalblog.blogspot.fr/2016/03/rxjava-problem-with-subjects.html
  6. What's wrong with polling? What's wrong with polling? Bob Bob

    Pull too fast: waste resources Pull at the wrong moment: get blocked Pull too slow: run behind Caroll Caroll Alice Alice Erik Erik source: Erik Meijer https://www.youtube.com/watch?v=FvMuPtuvP5w