![Page 1: Reactive - land of confusion - GitHub Pages“Reactive Programming is a subset of Asynchronous Programming and a paradigm where the availability of new information drives the logic](https://reader035.vdocument.in/reader035/viewer/2022081612/5f0f74c57e708231d444404a/html5/thumbnails/1.jpg)
Reactive - land of confusionPiotr Kafel ( @PiotrKafel )
![Page 2: Reactive - land of confusion - GitHub Pages“Reactive Programming is a subset of Asynchronous Programming and a paradigm where the availability of new information drives the logic](https://reader035.vdocument.in/reader035/viewer/2022081612/5f0f74c57e708231d444404a/html5/thumbnails/2.jpg)
Confusion!
![Page 3: Reactive - land of confusion - GitHub Pages“Reactive Programming is a subset of Asynchronous Programming and a paradigm where the availability of new information drives the logic](https://reader035.vdocument.in/reader035/viewer/2022081612/5f0f74c57e708231d444404a/html5/thumbnails/3.jpg)
What are we going to talk about
● Reactive systems● Reactive programming● Reactive streams
![Page 4: Reactive - land of confusion - GitHub Pages“Reactive Programming is a subset of Asynchronous Programming and a paradigm where the availability of new information drives the logic](https://reader035.vdocument.in/reader035/viewer/2022081612/5f0f74c57e708231d444404a/html5/thumbnails/4.jpg)
What are we NOT going to talk about
● Reactive functional programming
● Reactive developers
![Page 5: Reactive - land of confusion - GitHub Pages“Reactive Programming is a subset of Asynchronous Programming and a paradigm where the availability of new information drives the logic](https://reader035.vdocument.in/reader035/viewer/2022081612/5f0f74c57e708231d444404a/html5/thumbnails/5.jpg)
Reactive Systems
![Page 6: Reactive - land of confusion - GitHub Pages“Reactive Programming is a subset of Asynchronous Programming and a paradigm where the availability of new information drives the logic](https://reader035.vdocument.in/reader035/viewer/2022081612/5f0f74c57e708231d444404a/html5/thumbnails/6.jpg)
Statistics
Facebook 100 millions 1,9 billion users
Internet 1,5 billion 3,7 billion users
2008 2017
![Page 7: Reactive - land of confusion - GitHub Pages“Reactive Programming is a subset of Asynchronous Programming and a paradigm where the availability of new information drives the logic](https://reader035.vdocument.in/reader035/viewer/2022081612/5f0f74c57e708231d444404a/html5/thumbnails/7.jpg)
Reactive Manifesto
![Page 8: Reactive - land of confusion - GitHub Pages“Reactive Programming is a subset of Asynchronous Programming and a paradigm where the availability of new information drives the logic](https://reader035.vdocument.in/reader035/viewer/2022081612/5f0f74c57e708231d444404a/html5/thumbnails/8.jpg)
Message Driven
“Reactive Systems rely on asynchronous
message-passing to establish a boundary between components
that ensures loose coupling, isolation and location
transparency.
![Page 9: Reactive - land of confusion - GitHub Pages“Reactive Programming is a subset of Asynchronous Programming and a paradigm where the availability of new information drives the logic](https://reader035.vdocument.in/reader035/viewer/2022081612/5f0f74c57e708231d444404a/html5/thumbnails/9.jpg)
Asynchronous vs synchronous
Non blocking vs blocking
![Page 10: Reactive - land of confusion - GitHub Pages“Reactive Programming is a subset of Asynchronous Programming and a paradigm where the availability of new information drives the logic](https://reader035.vdocument.in/reader035/viewer/2022081612/5f0f74c57e708231d444404a/html5/thumbnails/10.jpg)
Event vs Message
Producer Consumers
Topic
![Page 11: Reactive - land of confusion - GitHub Pages“Reactive Programming is a subset of Asynchronous Programming and a paradigm where the availability of new information drives the logic](https://reader035.vdocument.in/reader035/viewer/2022081612/5f0f74c57e708231d444404a/html5/thumbnails/11.jpg)
Event vs Message
Producer Consumer
![Page 12: Reactive - land of confusion - GitHub Pages“Reactive Programming is a subset of Asynchronous Programming and a paradigm where the availability of new information drives the logic](https://reader035.vdocument.in/reader035/viewer/2022081612/5f0f74c57e708231d444404a/html5/thumbnails/12.jpg)
Location transparency
ComponentComponent ComponentLocalRemote
![Page 13: Reactive - land of confusion - GitHub Pages“Reactive Programming is a subset of Asynchronous Programming and a paradigm where the availability of new information drives the logic](https://reader035.vdocument.in/reader035/viewer/2022081612/5f0f74c57e708231d444404a/html5/thumbnails/13.jpg)
Elastic
![Page 14: Reactive - land of confusion - GitHub Pages“Reactive Programming is a subset of Asynchronous Programming and a paradigm where the availability of new information drives the logic](https://reader035.vdocument.in/reader035/viewer/2022081612/5f0f74c57e708231d444404a/html5/thumbnails/14.jpg)
Amdahl Law
S(n) = N / (1 + α (N – 1)) where● N is number of available threads● α is the fraction of the program that is serialized
![Page 15: Reactive - land of confusion - GitHub Pages“Reactive Programming is a subset of Asynchronous Programming and a paradigm where the availability of new information drives the logic](https://reader035.vdocument.in/reader035/viewer/2022081612/5f0f74c57e708231d444404a/html5/thumbnails/15.jpg)
Amdahl Law
![Page 16: Reactive - land of confusion - GitHub Pages“Reactive Programming is a subset of Asynchronous Programming and a paradigm where the availability of new information drives the logic](https://reader035.vdocument.in/reader035/viewer/2022081612/5f0f74c57e708231d444404a/html5/thumbnails/16.jpg)
Tools
![Page 17: Reactive - land of confusion - GitHub Pages“Reactive Programming is a subset of Asynchronous Programming and a paradigm where the availability of new information drives the logic](https://reader035.vdocument.in/reader035/viewer/2022081612/5f0f74c57e708231d444404a/html5/thumbnails/17.jpg)
Resilient
![Page 18: Reactive - land of confusion - GitHub Pages“Reactive Programming is a subset of Asynchronous Programming and a paradigm where the availability of new information drives the logic](https://reader035.vdocument.in/reader035/viewer/2022081612/5f0f74c57e708231d444404a/html5/thumbnails/18.jpg)
Replication, isolation and delegation
![Page 19: Reactive - land of confusion - GitHub Pages“Reactive Programming is a subset of Asynchronous Programming and a paradigm where the availability of new information drives the logic](https://reader035.vdocument.in/reader035/viewer/2022081612/5f0f74c57e708231d444404a/html5/thumbnails/19.jpg)
Tools
![Page 20: Reactive - land of confusion - GitHub Pages“Reactive Programming is a subset of Asynchronous Programming and a paradigm where the availability of new information drives the logic](https://reader035.vdocument.in/reader035/viewer/2022081612/5f0f74c57e708231d444404a/html5/thumbnails/20.jpg)
Lets wrap it up
![Page 21: Reactive - land of confusion - GitHub Pages“Reactive Programming is a subset of Asynchronous Programming and a paradigm where the availability of new information drives the logic](https://reader035.vdocument.in/reader035/viewer/2022081612/5f0f74c57e708231d444404a/html5/thumbnails/21.jpg)
In order to get more
information
![Page 22: Reactive - land of confusion - GitHub Pages“Reactive Programming is a subset of Asynchronous Programming and a paradigm where the availability of new information drives the logic](https://reader035.vdocument.in/reader035/viewer/2022081612/5f0f74c57e708231d444404a/html5/thumbnails/22.jpg)
![Page 23: Reactive - land of confusion - GitHub Pages“Reactive Programming is a subset of Asynchronous Programming and a paradigm where the availability of new information drives the logic](https://reader035.vdocument.in/reader035/viewer/2022081612/5f0f74c57e708231d444404a/html5/thumbnails/23.jpg)
Reactive programming
![Page 24: Reactive - land of confusion - GitHub Pages“Reactive Programming is a subset of Asynchronous Programming and a paradigm where the availability of new information drives the logic](https://reader035.vdocument.in/reader035/viewer/2022081612/5f0f74c57e708231d444404a/html5/thumbnails/24.jpg)
“Reactive Programming is a subset of Asynchronous Programming and a paradigm where the availability of new information drives the logic forward rather than having control flow driven by a thread-of-execution.”
“Reactive Programming versus Reactive Systems” Jonas Bonér and Viktor Klang
![Page 25: Reactive - land of confusion - GitHub Pages“Reactive Programming is a subset of Asynchronous Programming and a paradigm where the availability of new information drives the logic](https://reader035.vdocument.in/reader035/viewer/2022081612/5f0f74c57e708231d444404a/html5/thumbnails/25.jpg)
Example
CompletableFuture<UserData> userDataFuture = // get somehow user data
userDataFuture.thenCompose(userData -> {CompletableFuture<UserContacts> contactsFuture = getContacts(userData);CompletableFuture<UserPreferences> preferencesFuture = getPreferences(userData);return contactsFuture.thenCombine(preferencesFuture,
(contacts, preferences) -> new UserProfile(userData, contacts, preferences));})// more logic here...
![Page 26: Reactive - land of confusion - GitHub Pages“Reactive Programming is a subset of Asynchronous Programming and a paradigm where the availability of new information drives the logic](https://reader035.vdocument.in/reader035/viewer/2022081612/5f0f74c57e708231d444404a/html5/thumbnails/26.jpg)
Reactive streams
“Reactive Streams is an initiative to provide a standard for asynchronous stream processing with non-blocking back pressure.”
![Page 27: Reactive - land of confusion - GitHub Pages“Reactive Programming is a subset of Asynchronous Programming and a paradigm where the availability of new information drives the logic](https://reader035.vdocument.in/reader035/viewer/2022081612/5f0f74c57e708231d444404a/html5/thumbnails/27.jpg)
Interfacespublic interface Publisher<T> { public void subscribe(
Subscriber<? super T> s);}
public interface Subscriber<T> { public void onSubscribe(Subscription s); public void onNext(T t); public void onError(Throwable t); public void onComplete();}
public interface Subscription { public void request(long n); public void cancel();}
public interface Processor<T, R> extends Subscriber<T>, Publisher<R> {}
![Page 28: Reactive - land of confusion - GitHub Pages“Reactive Programming is a subset of Asynchronous Programming and a paradigm where the availability of new information drives the logic](https://reader035.vdocument.in/reader035/viewer/2022081612/5f0f74c57e708231d444404a/html5/thumbnails/28.jpg)
Implementations
![Page 29: Reactive - land of confusion - GitHub Pages“Reactive Programming is a subset of Asynchronous Programming and a paradigm where the availability of new information drives the logic](https://reader035.vdocument.in/reader035/viewer/2022081612/5f0f74c57e708231d444404a/html5/thumbnails/29.jpg)
Backpressure
![Page 30: Reactive - land of confusion - GitHub Pages“Reactive Programming is a subset of Asynchronous Programming and a paradigm where the availability of new information drives the logic](https://reader035.vdocument.in/reader035/viewer/2022081612/5f0f74c57e708231d444404a/html5/thumbnails/30.jpg)
Backpressure
Producer
queue
ConsumerWhat if Producer is faster than Consumer ?
![Page 31: Reactive - land of confusion - GitHub Pages“Reactive Programming is a subset of Asynchronous Programming and a paradigm where the availability of new information drives the logic](https://reader035.vdocument.in/reader035/viewer/2022081612/5f0f74c57e708231d444404a/html5/thumbnails/31.jpg)
Backpressure
Producer
queue
Consumerrequest(n)
![Page 32: Reactive - land of confusion - GitHub Pages“Reactive Programming is a subset of Asynchronous Programming and a paradigm where the availability of new information drives the logic](https://reader035.vdocument.in/reader035/viewer/2022081612/5f0f74c57e708231d444404a/html5/thumbnails/32.jpg)
Can I use reactive streams to implement reactive system ?
![Page 33: Reactive - land of confusion - GitHub Pages“Reactive Programming is a subset of Asynchronous Programming and a paradigm where the availability of new information drives the logic](https://reader035.vdocument.in/reader035/viewer/2022081612/5f0f74c57e708231d444404a/html5/thumbnails/33.jpg)
Summary
![Page 34: Reactive - land of confusion - GitHub Pages“Reactive Programming is a subset of Asynchronous Programming and a paradigm where the availability of new information drives the logic](https://reader035.vdocument.in/reader035/viewer/2022081612/5f0f74c57e708231d444404a/html5/thumbnails/34.jpg)
Thank you!... and by the way...
![Page 35: Reactive - land of confusion - GitHub Pages“Reactive Programming is a subset of Asynchronous Programming and a paradigm where the availability of new information drives the logic](https://reader035.vdocument.in/reader035/viewer/2022081612/5f0f74c57e708231d444404a/html5/thumbnails/35.jpg)
We are hiring!
![Page 36: Reactive - land of confusion - GitHub Pages“Reactive Programming is a subset of Asynchronous Programming and a paradigm where the availability of new information drives the logic](https://reader035.vdocument.in/reader035/viewer/2022081612/5f0f74c57e708231d444404a/html5/thumbnails/36.jpg)
Resources
● http://cdn-01.media-brady.com/store/stuk/media/catalog/product/cache/3/image/85e4522595efc69f496374d01ef2bf13/1420520593/d/m/dmeu_jan2013_1_std.lang.all.png
● http://www.reactivemanifesto.org/images/reactive-traits.svg● http://www.elyomnew.com/sites/default/files/styles/large/public/news/2015/01/07/unnamed_5.jpg?itok=IwHFS5N5● https://ae01.alicdn.com/kf/HTB1IYbSPXXXXXbBXXXXq6xXFXXXO/Century-of-font-b-Toys-b-font-Metal-Slinky-font-b-Rainbow-b-font-font-b.
jpg● http://cdn2.hubspot.net/hubfs/208250/apachejmeter.jpg● http://gatling.io/wp-content/uploads/2017/02/Gatling-logo.png● http://rtcmagazine.com/files/images/4733/rtc1306_td_vio_fig01_original_large.jpg● https://s-media-cache-ak0.pinimg.com/736x/7b/de/b6/7bdeb635b6f4ab129c282e9ce74b1506.jpg● https://cdn-images-1.medium.com/max/318/1*r15n693DUONwGqkRPmSC3g.png● http://jonasboner.com/images/posts/reactive-design-patterns-book-cover.png● https://javastart.pl/b/wp-content/uploads/2015/08/rxjava.png● http://doc.akka.io/docs/akka/current/images/akka-icon.svg● https://avatars3.githubusercontent.com/u/4201559?v=3&s=400