SlideShare a Scribd company logo
1 of 70
Download to read offline
byVadymKazulkinandRodionAlukhanov, ip.labsGmbH
Reactive Programming in Java
Conta
ct
Vadym Kazulkin, ip.labs GmbH:
v.kazulkin@iplabs.de
www.xing.com/profile/Vadym_Kazulkin
@VKazulkin
Rodion Alukhanov, ip.labs GmbH :
r.alukhanov@iplabs.de
www.xing.com/profile/Rodion_Alukhanov
Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH
ip.labsGmbH
Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH
Agenda
• Reactive Programming in general
• Reactive Streams and JDK 9 Flow API
• RxJava 2
• Spring Reactor 3
• Demo of reactive application with Spring 5, Spring Boot 2, Netty, MongoDB
and Thymeleaf technology stack
Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH
Reactive Streams
Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH
Subscriber/Publisher
Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH
Subscription
Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH
Publisher Implementations
Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH
RxJava 2
Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH
public List<Photo> getPhotos() {
List<Photo> result = …
while (...) {
result.add(...);
}
return result;
}
Observable<Photo> publisher = Observable.create(subscriber -> {
while (...) {
Photo photo = ...
subscriber.doNext(photo);
}
subscriber.onCompleted();
});
Classic vs. Reactive (Cold Publisher)
for (Item item : getPhoto()) {
System.out.println(item.toString());
}
publisher.subscribe(item->{
System.out.println(item.toString());
});
Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH
RxJava 2 Basics
Observable<Customer> customers = ...
Observable<Customer> adults = customers.filter(c -> c.age > 18);
Observable<Address> addresses = adults.map(c -> c.getDefaultAddress());
Observable<Order> orders = customers.flatMap(c ->
Observable.fromArray(c.getOrders())
);
Observable<Picture> uploadedPhotos = customers.flatMap(c ->
Observable.fromArray(dao.loadPhotosByCustomer(c.getId()))
);
Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH
Example. Print Photo Book
Fetching photo IDs from photo-book
Loading meta data from database (ID, Dimentions, Source etc.)
Loading images from server HDD if avaliable
Loading missing images from source (for example Cloud
Service)
Validating images
+
User authentication & authorisation
0ms
10x100ms
90x50ms
10x500ms
100x50ms
max500ms
Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH
Loading Meta Data. Buffer.
Observable<Integer> ids = Observable.fromIterable(book.getPhotoIDs());
Observable<List<Integer>> idBatches = ids.buffer(10);
Observable<MetaData> metadata =
idBatches.flatMap(ids -> metadataDao.loadingMetadata(ids));
Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH
Loading Picture from HDD. FlatMap with at most a single result
Observable<PictureFile> fromDisk =
ids.flatMap(id -> loadingFromDisk(id));
public Observable<PictureFile> loadingFromDisk(Integer id) {
Observable<PictureFile> result = Observable.create(s -> {
try {
s.onNext(pictureDao.loadFromHdd(id));
} catch (PictureNotFound e) {
System.out.println("Not found on disk " + id);
}
s.onComplete();
}
return result;
}
Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH
Loading from Cloud. Filter
Observable<PictureFile> fromCloud =
metadata.filter(m->m.isFromCloud())
.flatMap(id -> loadingFromCloud(id.id));
metadata 1
metadata 2
metadata 3
metadata 4
metadata 5
disk-file 1
disk-file 2
disk-file 4
cloud-file 3
cloud-file 5
Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH
Merging Cloud and HDD
Observable<PictureFile> allPictures = fromDisk.mergeWith(fromCloud);
metadata 1
metadata 2
metadata 3
metadata 4
metadata 5
disk-file 1
cloud-file 3
disk-file 2
disk-file 4
cloud-file 5
Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH
Joining Metadata with Picture Files
Observable<Pair<MetaData, PictureFile>> pairs =
metadata.join(allPictures, ..., Pair::of);
metadata 1 + disk-file 1
metadata 2 + disk-file 1
metadata 3 + disk-file 1
metadata 2 + disk-file 2
metadata 3 + cloud-file 3
pairs = pairs.filter(p->p.fst.id == p.snd.id)
Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH
Observable<Picture> pictures = pairs.map(p->new Picture(p.snd, p.fst));
Joining Metadata with Picture Files
Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH
Validating Result
Observable<Picture> validated = pictures.flatMap(p→validation(p));
public static Observable<Picture> validation(Picture p) {
return Observable.<Picture>create(s -> {
// do the job
s.onNext(p);
s.onComplete();
});
}
Observable<Picture> validated = pictures.map(p→validation2(p));
public static Picture validation2(Picture p) {
// do the job
return p;
}
Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH
Adding Authentication
Observable<Boolean> auth = auth();
Observable<Picture> result =
Observable.combineLatest(auth, validated, (a,p)->p);
Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH
Back in the „Real World“
result.blockingForEach((item)->{
System.out.println("FINISHED -> " + item.id);
});
Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH
Reactive Code
Observable<Integer> ids = loadingIds();
Observable<MetaData> metadata = ids.buffer(10).flatMap(id -> loadingMetadata(id));
Observable<PictureFile> fromDisk = ids.flatMap(id -> loadingFromDisk(id));
Observable<PictureFile> fromCloud = metadata.filter(m->m.cloud).
flatMap(id -> loadingFromCloud(id.id));
Observable<PictureFile> allPictures = fromDisk.mergeWith(fromCloud);
Observable<Long> wait = Observable.never();
Observable<Pair<MetaData, PictureFile>> pairs =
metadata.join(allPictures, (m)-> wait, (f)-> wait, Pair::of);
Observable<Picture> pictures =
pairs.filter(p->p.fst.id == p.snd.id).map(p->new Picture(p.snd, p.fst));
Observable<Picture> validated = pictures.flatMap(p->validation(p));
Observable<Boolean> auth = auth();
Observable<Pair<Boolean, Picture>> result =
Observable.combineLatest(auth, validated,(a,p)->p);
Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH
Where is Concurrency?
private Scheduler scheduler = Schedulers.io();
public Observable<PictureFile> loadingFromDisk(Integer id) {
Observable<PictureFile> result = Observable.create(s -> {
try {
s.onNext(pictureDao.loadFromHdd(id));
} catch (PictureNotFound e) {
System.out.println("Not found on disk " + id);
}
s.onComplete();
}
return result.subscribeOn(scheduler);
}
Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH
Observable<Integer> ids = loadingIds();
Observable<MetaData> metadata = ids.buffer(10).flatMap(id -> loadingMetadata(id));
Observable<PictureFile> fromDisk = ids.flatMap(id -> loadingFromDisk(id));
Observable<PictureFile> fromCloud = metadata.filter(m->m.cloud).
flatMap(id -> loadingFromCloud(id.id));
Observable<PictureFile> allPictures = fromDisk.mergeWith(fromCloud);
Observable<Long> wait = Observable.interval(1000, TimeUnit.SECONDS);
Observable<Pair<MetaData, PictureFile>> pairs =
metadata.join(allPictures, (m)-> wait, (f)-> wait, Pair::of);
Observable<Picture> pictures =
pairs.filter(p->p.fst.id == p.snd.id).map(p->new Picture(p.snd, p.fst));
Observable<Picture> validated = pictures.flatMap(p->validation(p));
Observable<Boolean> auth = auth();
Observable<Pair<Boolean, Picture>> result =
Observable.combineLatest(auth, validated, Pair::of);
Compare Results
Classic -> 20 sec
Reactor -> 1 sec
Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH
SpringReactor 3
Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH
SpringReactor Timeline
Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH
SpringReactor 3BigPicture
Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH
ReactiveStreamInterfaces
Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH
Spring Reactor 3 Main Types
Flux implements Publisher
is capable of emitting of 0 or more items
Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH
Spring Reactor 3 Main Types
Mono implements Publisher
can emit at most once item
Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH
Spring Reactor 3 Examples
Publisher creation
Flux<String> productTitles = Flux.just("Print 9x13", "Photobook A4", "Calendar A4");
Mono<String> productTitles = Mono.just("Print 9x13");
Flux<String> productTitles = Flux.fromIterable(Arrays.asList("Print 9x13",
"Photobook A4", "Calendar A4"));
Flux<String> productTitles = Flux.fromArray(new String[]{"Print 9x13",
"Photobook A4", "Calendar A4"});
Flux<String> productTitles = Flux.fromStream(Stream.of("Print 9x13",
"Photobook A4", "Calendar A4“));
Mono.fromCallable(), Mono.fromRunnable(), Mono.fromFuture()
Flux.empty(), Mono.empty(), Flux.error(), Mono.error()
Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH
Spring Reactor 3 Examples
Event subscription
Flux<String> productTitles = Flux.just("Print 9x13", "Photobook A4", "Calendar A4");
productTitles.subscribe(System.out::println);
Output:
Print 9x13
Photobook A4
Calendar A4
Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH
Spring Reactor 3 Examples
Logging
Flux<String> productTitles = Flux.just("Print 9x13", "Photobook A4", "Calendar A4");
productTitles.log().subscribe(System.out::println);
Output:
INFO reactor.Flux.Array.2 - | onSubscribe()
INFO reactor.Flux.Array.2 - | request(unbounded)
INFO reactor.Flux.Array.2 - | onNext(Print 9x13)
Print 9x13
INFO reactor.Flux.Array.2 - | onNext(Photobook A4)
Photobook A4
INFO reactor.Flux.Array.2 - | onNext(Calendar A4)
Calendar A4
INFO reactor.Flux.Array.2 - | onComplete()
Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH
ReactiveStreamInterfaces
Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH
Spring Reactor 3 Examples
Event subscription with own Subscriber
Flux<String> productTitles = Flux.just("Print 9x13", "Photobook A4", "Calendar A4");
productTitles.subscribe(new Subscriber<String>() {
@Override
public void onSubscribe(Subscription s) {
s.request(Long.MAX_VALUE);
}
@Override
public void onNext(String t) {
System.out.println(t);
}
@Override
public void onError(Throwable t) {
}
@Override
public void onComplete() {
}
});
Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH
Spring Reactor 3 Examples
Event subscription with custom Subscriber with back-pressure
Flux<String> productTitles = Flux.just("Print 9x13", "Photobook A4", "Calendar A4");
productTitles.subscribe(new Subscriber<String>() {
private long count = 0;
private Subscription subscription;
public void onSubscribe(Subscription subscription) {
this.subscription = subscription;
subscription.request(2);
}
public void onNext(String t) {
count++;
if (count>=2) {
count = 0;
subscription.request(2);
}
}
...
Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH
Spring Reactor 3 Examples
Event subscription with custom Subscriber with back-pressure
Flux<String> productTitles = Flux.just("Print 9x13", "Photobook A4", "Calendar A4");
productTitles.log().subscribe(new Subscriber<String>()
{subscription.request(2);..}
Output:
INFO reactor.Flux.Array.2 - | onSubscribe()
INFO reactor.Flux.Array.2 - | request(2)
INFO reactor.Flux.Array.2 - | onNext(Print 9x13)
Print 9x13
INFO reactor.Flux.Array.2 - | onNext(Photobook A4)
Photobook A4
INFO reactor.Flux.Array.2 - | request(2)
INFO reactor.Flux.Array.2 - | onNext(Calendar A4)
Calendar A4
INFO reactor.Flux.Array.2 - | onComplete()
Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH
Spring Reactor 3 Operations
Transforming (map, scan)
Combining (merge, startWith)
Filtering (last, skip)
Mathematical (count, average, max)
Boolean (every, some, includes)
Source: http://rxmarbles.com
Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH
Spring Reactor 3 Examples
Elements filtering
Flux<String> productTitles = Flux.just("Print 9x13", "Photobook A4", "Calendar A4");
Flux<String> productTitlesStartingWithP =
productTitles.filter(productTitle-> productTitle.startsWith("P"));
productTitlesStartingWithP.subscribe(System.out::println);
Output:
Print 9x13
Photobook A4
Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH
Spring Reactor 3 Examples
Elements counter
Flux<String> productTitles = Flux.just("Print 9x13", "Photobook A4", "Calendar A4");
Mono<Long> productTitlesCount = productTitles.count();
productTitlesCount.subscribe(System.out::println);
Output:
3
Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH
Spring Reactor 3 Examples
Check if all elements match a condition
Flux<String> productTitles = Flux.just("Print 9x13", "Photobook A4", "Calendar A4");
Mono<Boolean> allProductTitlesLengthBiggerThan5=
productTitles.all(productTitle-> productTitle.length() > 5);
allProductTitlesLengthBiggerThan5.subscribe(System.out::println);
Output:
true
Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH
Spring Reactor 3 Examples
Element mapping
Flux<String> productTitles = Flux.just("Print 9x13", "Photobook A4", "Calendar A4");
Flux<Integer> productTitlesLength =
productTitles.map(productTitle-> productTitle.length()) ;
productTitlesLength.subscribe(System.out::println);
Output:
10
12
11
Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH
Spring Reactor 3 Examples
Zipping of 2 Publishers
Flux<String> productTitles = Flux.just("Print 9x13", "Photobook A4", "Calendar A4");
Flux<Double> productPrices = Flux.fromIterable(Arrays.asList(0.09, 29.99, 15.99));
Flux<Tuple2<String, Double>> zippedFlux = Flux.zip(productTitles, productPrices);
zippedFlux.subscribe(System.out::println);
Output:
[Print 9x13,0.09]
[Photobook A4,29.99]
[Calendar A4,15.99]
Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH
Spring Reactor 3 Examples
Parallel processing
Flux<String> productTitles = Flux.just("Print 9x13", "Photobook A4", "Calendar A4");
Flux<Double> productPrices = Flux.fromIterable(Arrays.asList(0.09, 29.99, 15.99));
Flux.zip(productTitles, productPrices)
.parallel() //returns ParallelFlux, uses all available CPUs or call
parallel(numberOfCPUs)
.runOn(Schedulers.parallel())
.sequential()
.subscribe(System.out::println);
Output:
[Print 9x13,0.09]
[Photobook A4,29.99]
[Calendar A4,15.99]
Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH
Spring Reactor 3 Examples
Blocking Publisher
BlockingFlux:
Flux<String> productTitles = Flux.just("Print 9x13", "Photobook A4", "Calendar A4");
Iterable<String> blockingConcatProductTitles =
productTitles.concatWith(anotherProductTitle) .toIterable();
or
Stream<String> blockingConcatProductTitles =
productTitles.concatWith(anotherProductTitle) .toStream();
BlockingMono:
String blockingProductTitles = Mono.just("Print 9x13") .block();
or
CompletableFuture blockingProductTitles = Mono.just("Print 9x13").toFuture();
Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH
LMAX Disruptor
RingBuffer withmultipleproducersandconsumers
Source: https://github.com/LMAX-Exchange/disruptor/wiki/Introduction
Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH
Spring Reactor 3 Examples
Test the publishers
Flux<String> productTitles = Flux.just("Print 9x13", "Photobook A4", "Calendar A4");
Duration verificationDuration = StepVerifier.create(productTitles).
expectNextMatches(productTitle -> productTitle.equals("Print 9x13")).
expectNextMatches(productTitle -> productTitle.equals("Photobook A4")).
expectNextMatches(productTitle -> productTitle.equals("Calendar A4")).
expectComplete().
verify());
Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH
Spring Reactor 3 Examples
Test the publishers
Flux<String> productTitles = Flux.just("Print 9x13", "Photobook A4", "Calendar A4");
StepVerifier.create(productTitles).
expectNextMatches(productTitle -> productTitle.equals("Print 9x13")).
expectNextMatches(productTitle -> productTitle.equals("Photobook A4")).
expectNextMatches(productTitle -> productTitle.equals("Calendar A4")).
expectComplete().
verify())
Output:
Exception in thread "main" java.lang.AssertionError: expectation
"expectComplete" failed (expected: onComplete(); actual: onNext(Calendar
A4));
Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH
Spring 5 / Spring Boot 2 / Netty /
MongoDB / Thymeleaf
Demo
Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH
Spring5/ SpringWebReactive
Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH
Spring5/ SpringWebReactive
Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH
Spring5/ SpringWebReactive
Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH
Dependencies
Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH
Non-blockingNettyWebClient
Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH
MongoDB ReactiveDatabaseTemplate
Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH
Model
Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH
Repository
Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH
Thymeleaf ReactiveView Resolver
Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH
Controller
Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH
View
Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH
Non-blockingJSON ParsingwithJackson
Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH
Spring5/ SpringWebReactive
Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH
Functional Endpoint
• Alternative to the annotated-based programming (uses the
same Reactive Web Spring API)
• Lightweight functional programming model
• Functions are used to route and handle requests
• Contracts are designed for immutability
Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH
Functional Endpoint
Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH
Benefits of the Reactive Applications
• Efficient resource utilization (spending less money on servers
and data centres)
• Processing higher loads with fewer threads
Source: https://spring.io/blog/2016/06/07/notes-on-reactive-programming-part-i-the-reactive-landscape
Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH
Uses Cases for Reactive Applications
• External service calls
• Highly concurrent message consumers
• Single page applications with unbounded elements to display
Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH
Pitfalls of reactive programming
• For the wrong problem, this makes things worse
• Hard to debug (no control over executing thread)
• Mistakenly blocking a single request leads to increased
latency for all requests -> blocking all requests brings a
server to its knees
Source: https://spring.io/blog/2016/07/20/notes-on-reactive-programming-part-iii-a-simple-http-server-application
Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH
Questions?
Conta
ct
Vadym Kazulkin, ip.labs GmbH:
v.kazulkin@iplabs.de
www.xing.com/profile/Vadym_Kazulkin
@VKazulkin
Rodion Alukhanov, ip.labs GmbH :
r.alukhanov@iplabs.de
www.xing.com/profile/Rodion_Alukhanov
w w w.iplabs.de
Thank You!

More Related Content

Similar to "Reactive Programming in Java" at CamelCaseCon 2018 by Vadym Kazulkin/Rodion Alukhanov

"Performance measurements with Java Microbenchmark Harness (JMH)" at Eclipse ...
"Performance measurements with Java Microbenchmark Harness (JMH)" at Eclipse ..."Performance measurements with Java Microbenchmark Harness (JMH)" at Eclipse ...
"Performance measurements with Java Microbenchmark Harness (JMH)" at Eclipse ...Vadym Kazulkin
 
Projeto-web-services-Spring-Boot-JPA.pdf
Projeto-web-services-Spring-Boot-JPA.pdfProjeto-web-services-Spring-Boot-JPA.pdf
Projeto-web-services-Spring-Boot-JPA.pdfAdrianoSantos888423
 
Augmented Reality with JavaScript
Augmented Reality with JavaScriptAugmented Reality with JavaScript
Augmented Reality with JavaScriptRay Deck
 
Apollo. The client we deserve
Apollo. The client we deserveApollo. The client we deserve
Apollo. The client we deserveYuri Nezdemkovski
 
React Native - Short introduction
React Native - Short introductionReact Native - Short introduction
React Native - Short introductionVisuality
 
Object detection
Object detectionObject detection
Object detectionSomesh Vyas
 
Maxim Salnikov - Service Worker: taking the best from the past experience for...
Maxim Salnikov - Service Worker: taking the best from the past experience for...Maxim Salnikov - Service Worker: taking the best from the past experience for...
Maxim Salnikov - Service Worker: taking the best from the past experience for...Codemotion
 
Highlights from Java 10, 11 and 12 and Future of Java at Javaland 2019 By Vad...
Highlights from Java 10, 11 and 12 and Future of Java at Javaland 2019 By Vad...Highlights from Java 10, 11 and 12 and Future of Java at Javaland 2019 By Vad...
Highlights from Java 10, 11 and 12 and Future of Java at Javaland 2019 By Vad...Vadym Kazulkin
 
From User Action to Framework Reaction
From User Action to Framework ReactionFrom User Action to Framework Reaction
From User Action to Framework ReactionJonas Bandi
 
Scala Future & Promises
Scala Future & PromisesScala Future & Promises
Scala Future & PromisesKnoldus Inc.
 
Java 6 [Mustang] - Features and Enchantments
Java 6 [Mustang] - Features and Enchantments Java 6 [Mustang] - Features and Enchantments
Java 6 [Mustang] - Features and Enchantments Pavel Kaminsky
 
Highlights from Java 10-13 and Future of Java at JCON 2019 by Alukhanov and K...
Highlights from Java 10-13 and Future of Java at JCON 2019 by Alukhanov and K...Highlights from Java 10-13 and Future of Java at JCON 2019 by Alukhanov and K...
Highlights from Java 10-13 and Future of Java at JCON 2019 by Alukhanov and K...Vadym Kazulkin
 
From User Action to Framework Reaction
From User Action to Framework ReactionFrom User Action to Framework Reaction
From User Action to Framework Reactionjbandi
 
Multiple Screens
Multiple ScreensMultiple Screens
Multiple Screensgraphitech
 
Heat up your stack
Heat up your stackHeat up your stack
Heat up your stackRico Lin
 
Sufan presentation
Sufan presentationSufan presentation
Sufan presentationSufanhk
 
React & The Art of Managing Complexity
React &  The Art of Managing ComplexityReact &  The Art of Managing Complexity
React & The Art of Managing ComplexityRyan Anklam
 
ForwardJS 2017 - Fullstack end-to-end Test Automation with node.js
ForwardJS 2017 -  Fullstack end-to-end Test Automation with node.jsForwardJS 2017 -  Fullstack end-to-end Test Automation with node.js
ForwardJS 2017 - Fullstack end-to-end Test Automation with node.jsMek Srunyu Stittri
 

Similar to "Reactive Programming in Java" at CamelCaseCon 2018 by Vadym Kazulkin/Rodion Alukhanov (20)

"Performance measurements with Java Microbenchmark Harness (JMH)" at Eclipse ...
"Performance measurements with Java Microbenchmark Harness (JMH)" at Eclipse ..."Performance measurements with Java Microbenchmark Harness (JMH)" at Eclipse ...
"Performance measurements with Java Microbenchmark Harness (JMH)" at Eclipse ...
 
Projeto-web-services-Spring-Boot-JPA.pdf
Projeto-web-services-Spring-Boot-JPA.pdfProjeto-web-services-Spring-Boot-JPA.pdf
Projeto-web-services-Spring-Boot-JPA.pdf
 
Augmented Reality with JavaScript
Augmented Reality with JavaScriptAugmented Reality with JavaScript
Augmented Reality with JavaScript
 
Apollo. The client we deserve
Apollo. The client we deserveApollo. The client we deserve
Apollo. The client we deserve
 
React Native - Short introduction
React Native - Short introductionReact Native - Short introduction
React Native - Short introduction
 
ConSol_IBM_webcast_quarkus_the_blue_hedgehog_of_java_web_frameworks
ConSol_IBM_webcast_quarkus_the_blue_hedgehog_of_java_web_frameworksConSol_IBM_webcast_quarkus_the_blue_hedgehog_of_java_web_frameworks
ConSol_IBM_webcast_quarkus_the_blue_hedgehog_of_java_web_frameworks
 
Object detection
Object detectionObject detection
Object detection
 
Maxim Salnikov - Service Worker: taking the best from the past experience for...
Maxim Salnikov - Service Worker: taking the best from the past experience for...Maxim Salnikov - Service Worker: taking the best from the past experience for...
Maxim Salnikov - Service Worker: taking the best from the past experience for...
 
Highlights from Java 10, 11 and 12 and Future of Java at Javaland 2019 By Vad...
Highlights from Java 10, 11 and 12 and Future of Java at Javaland 2019 By Vad...Highlights from Java 10, 11 and 12 and Future of Java at Javaland 2019 By Vad...
Highlights from Java 10, 11 and 12 and Future of Java at Javaland 2019 By Vad...
 
From User Action to Framework Reaction
From User Action to Framework ReactionFrom User Action to Framework Reaction
From User Action to Framework Reaction
 
Scala Future & Promises
Scala Future & PromisesScala Future & Promises
Scala Future & Promises
 
Java 6 [Mustang] - Features and Enchantments
Java 6 [Mustang] - Features and Enchantments Java 6 [Mustang] - Features and Enchantments
Java 6 [Mustang] - Features and Enchantments
 
Highlights from Java 10-13 and Future of Java at JCON 2019 by Alukhanov and K...
Highlights from Java 10-13 and Future of Java at JCON 2019 by Alukhanov and K...Highlights from Java 10-13 and Future of Java at JCON 2019 by Alukhanov and K...
Highlights from Java 10-13 and Future of Java at JCON 2019 by Alukhanov and K...
 
From User Action to Framework Reaction
From User Action to Framework ReactionFrom User Action to Framework Reaction
From User Action to Framework Reaction
 
Multiple Screens
Multiple ScreensMultiple Screens
Multiple Screens
 
Learn react-js
Learn react-jsLearn react-js
Learn react-js
 
Heat up your stack
Heat up your stackHeat up your stack
Heat up your stack
 
Sufan presentation
Sufan presentationSufan presentation
Sufan presentation
 
React & The Art of Managing Complexity
React &  The Art of Managing ComplexityReact &  The Art of Managing Complexity
React & The Art of Managing Complexity
 
ForwardJS 2017 - Fullstack end-to-end Test Automation with node.js
ForwardJS 2017 -  Fullstack end-to-end Test Automation with node.jsForwardJS 2017 -  Fullstack end-to-end Test Automation with node.js
ForwardJS 2017 - Fullstack end-to-end Test Automation with node.js
 

More from Vadym Kazulkin

Amazon DevOps Guru for Serverless Applications at DevOpsCon 2024 London
Amazon DevOps Guru for Serverless Applications at DevOpsCon 2024 LondonAmazon DevOps Guru for Serverless Applications at DevOpsCon 2024 London
Amazon DevOps Guru for Serverless Applications at DevOpsCon 2024 LondonVadym Kazulkin
 
Making sense of service quotas of AWS Serverless services and how to deal wit...
Making sense of service quotas of AWS Serverless services and how to deal wit...Making sense of service quotas of AWS Serverless services and how to deal wit...
Making sense of service quotas of AWS Serverless services and how to deal wit...Vadym Kazulkin
 
How to reduce cold starts for Java Serverless applications in AWS at JCON Wor...
How to reduce cold starts for Java Serverless applications in AWS at JCON Wor...How to reduce cold starts for Java Serverless applications in AWS at JCON Wor...
How to reduce cold starts for Java Serverless applications in AWS at JCON Wor...Vadym Kazulkin
 
How to reduce cold starts for Java Serverless applications in AWS at Serverle...
How to reduce cold starts for Java Serverless applications in AWS at Serverle...How to reduce cold starts for Java Serverless applications in AWS at Serverle...
How to reduce cold starts for Java Serverless applications in AWS at Serverle...Vadym Kazulkin
 
Revolutionize DevOps lifecycle with Amazon CodeCatalyst and DevOps Guru at De...
Revolutionize DevOps lifecycle with Amazon CodeCatalyst and DevOps Guru at De...Revolutionize DevOps lifecycle with Amazon CodeCatalyst and DevOps Guru at De...
Revolutionize DevOps lifecycle with Amazon CodeCatalyst and DevOps Guru at De...Vadym Kazulkin
 
Amazon DevOps Guru for the Serverless Applications at AWS Community Day NL 2023
Amazon DevOps Guru for the Serverless Applications at AWS Community Day NL 2023Amazon DevOps Guru for the Serverless Applications at AWS Community Day NL 2023
Amazon DevOps Guru for the Serverless Applications at AWS Community Day NL 2023Vadym Kazulkin
 
Making sense of service quotas of AWS Serverless services and how to deal wit...
Making sense of service quotas of AWS Serverless services and how to deal wit...Making sense of service quotas of AWS Serverless services and how to deal wit...
Making sense of service quotas of AWS Serverless services and how to deal wit...Vadym Kazulkin
 
How to reduce cold starts for Java Serverless applications in AWS at InfoShar...
How to reduce cold starts for Java Serverless applications in AWS at InfoShar...How to reduce cold starts for Java Serverless applications in AWS at InfoShar...
How to reduce cold starts for Java Serverless applications in AWS at InfoShar...Vadym Kazulkin
 
Adopting Java for the Serverless World at Voxxed Days Bruxelles 2023
Adopting Java for the Serverless World at Voxxed Days Bruxelles 2023Adopting Java for the Serverless World at Voxxed Days Bruxelles 2023
Adopting Java for the Serverless World at Voxxed Days Bruxelles 2023Vadym Kazulkin
 
Github Copilot vs Amazon CodeWhisperer for Java developers at JCON 2023
Github Copilot vs Amazon CodeWhisperer for Java developers at JCON 2023Github Copilot vs Amazon CodeWhisperer for Java developers at JCON 2023
Github Copilot vs Amazon CodeWhisperer for Java developers at JCON 2023Vadym Kazulkin
 
AWS Lambda SnapStart: Why, How and What AWS Serverless Meetup New York Boston...
AWS Lambda SnapStart: Why, How and What AWS Serverless Meetup New York Boston...AWS Lambda SnapStart: Why, How and What AWS Serverless Meetup New York Boston...
AWS Lambda SnapStart: Why, How and What AWS Serverless Meetup New York Boston...Vadym Kazulkin
 
Revolutionize DevOps with ML capabilities. Deep dive into Amazon CodeGuru and...
Revolutionize DevOps with ML capabilities. Deep dive into Amazon CodeGuru and...Revolutionize DevOps with ML capabilities. Deep dive into Amazon CodeGuru and...
Revolutionize DevOps with ML capabilities. Deep dive into Amazon CodeGuru and...Vadym Kazulkin
 
Amazon DevOps Guru for the Serverless Applications at AWS Community Day Bene...
Amazon DevOps Guru for the Serverless Applications at  AWS Community Day Bene...Amazon DevOps Guru for the Serverless Applications at  AWS Community Day Bene...
Amazon DevOps Guru for the Serverless Applications at AWS Community Day Bene...Vadym Kazulkin
 
Amazon CodeGuru vs SonarQube for Java Developers at JCon 2022
Amazon CodeGuru vs SonarQube for Java Developers at JCon 2022Amazon CodeGuru vs SonarQube for Java Developers at JCon 2022
Amazon CodeGuru vs SonarQube for Java Developers at JCon 2022Vadym Kazulkin
 
Adopting Java for the Serverless World at JUG Saxony Day 2022
Adopting Java for the Serverless World at JUG Saxony Day 2022Adopting Java for the Serverless World at JUG Saxony Day 2022
Adopting Java for the Serverless World at JUG Saxony Day 2022Vadym Kazulkin
 
Projects Valhalla and Loom DWX 2022
Projects Valhalla and Loom DWX 2022Projects Valhalla and Loom DWX 2022
Projects Valhalla and Loom DWX 2022Vadym Kazulkin
 
Adopting Java for the Serverless World at VoxxedDays Luxemburg
Adopting Java for the Serverless World at VoxxedDays LuxemburgAdopting Java for the Serverless World at VoxxedDays Luxemburg
Adopting Java for the Serverless World at VoxxedDays LuxemburgVadym Kazulkin
 
Revolutionize DevOps with ML capabilities. Introduction to Amazon CodeGuru an...
Revolutionize DevOps with ML capabilities. Introduction to Amazon CodeGuru an...Revolutionize DevOps with ML capabilities. Introduction to Amazon CodeGuru an...
Revolutionize DevOps with ML capabilities. Introduction to Amazon CodeGuru an...Vadym Kazulkin
 
Adopting Java for the Serverless World at JUG Bonn 2022
Adopting Java for the Serverless World at JUG Bonn 2022Adopting Java for the Serverless World at JUG Bonn 2022
Adopting Java for the Serverless World at JUG Bonn 2022Vadym Kazulkin
 
Adopting Java for the Serverless World at JUG Darmstadt 2022
Adopting Java for the Serverless World at JUG Darmstadt 2022Adopting Java for the Serverless World at JUG Darmstadt 2022
Adopting Java for the Serverless World at JUG Darmstadt 2022Vadym Kazulkin
 

More from Vadym Kazulkin (20)

Amazon DevOps Guru for Serverless Applications at DevOpsCon 2024 London
Amazon DevOps Guru for Serverless Applications at DevOpsCon 2024 LondonAmazon DevOps Guru for Serverless Applications at DevOpsCon 2024 London
Amazon DevOps Guru for Serverless Applications at DevOpsCon 2024 London
 
Making sense of service quotas of AWS Serverless services and how to deal wit...
Making sense of service quotas of AWS Serverless services and how to deal wit...Making sense of service quotas of AWS Serverless services and how to deal wit...
Making sense of service quotas of AWS Serverless services and how to deal wit...
 
How to reduce cold starts for Java Serverless applications in AWS at JCON Wor...
How to reduce cold starts for Java Serverless applications in AWS at JCON Wor...How to reduce cold starts for Java Serverless applications in AWS at JCON Wor...
How to reduce cold starts for Java Serverless applications in AWS at JCON Wor...
 
How to reduce cold starts for Java Serverless applications in AWS at Serverle...
How to reduce cold starts for Java Serverless applications in AWS at Serverle...How to reduce cold starts for Java Serverless applications in AWS at Serverle...
How to reduce cold starts for Java Serverless applications in AWS at Serverle...
 
Revolutionize DevOps lifecycle with Amazon CodeCatalyst and DevOps Guru at De...
Revolutionize DevOps lifecycle with Amazon CodeCatalyst and DevOps Guru at De...Revolutionize DevOps lifecycle with Amazon CodeCatalyst and DevOps Guru at De...
Revolutionize DevOps lifecycle with Amazon CodeCatalyst and DevOps Guru at De...
 
Amazon DevOps Guru for the Serverless Applications at AWS Community Day NL 2023
Amazon DevOps Guru for the Serverless Applications at AWS Community Day NL 2023Amazon DevOps Guru for the Serverless Applications at AWS Community Day NL 2023
Amazon DevOps Guru for the Serverless Applications at AWS Community Day NL 2023
 
Making sense of service quotas of AWS Serverless services and how to deal wit...
Making sense of service quotas of AWS Serverless services and how to deal wit...Making sense of service quotas of AWS Serverless services and how to deal wit...
Making sense of service quotas of AWS Serverless services and how to deal wit...
 
How to reduce cold starts for Java Serverless applications in AWS at InfoShar...
How to reduce cold starts for Java Serverless applications in AWS at InfoShar...How to reduce cold starts for Java Serverless applications in AWS at InfoShar...
How to reduce cold starts for Java Serverless applications in AWS at InfoShar...
 
Adopting Java for the Serverless World at Voxxed Days Bruxelles 2023
Adopting Java for the Serverless World at Voxxed Days Bruxelles 2023Adopting Java for the Serverless World at Voxxed Days Bruxelles 2023
Adopting Java for the Serverless World at Voxxed Days Bruxelles 2023
 
Github Copilot vs Amazon CodeWhisperer for Java developers at JCON 2023
Github Copilot vs Amazon CodeWhisperer for Java developers at JCON 2023Github Copilot vs Amazon CodeWhisperer for Java developers at JCON 2023
Github Copilot vs Amazon CodeWhisperer for Java developers at JCON 2023
 
AWS Lambda SnapStart: Why, How and What AWS Serverless Meetup New York Boston...
AWS Lambda SnapStart: Why, How and What AWS Serverless Meetup New York Boston...AWS Lambda SnapStart: Why, How and What AWS Serverless Meetup New York Boston...
AWS Lambda SnapStart: Why, How and What AWS Serverless Meetup New York Boston...
 
Revolutionize DevOps with ML capabilities. Deep dive into Amazon CodeGuru and...
Revolutionize DevOps with ML capabilities. Deep dive into Amazon CodeGuru and...Revolutionize DevOps with ML capabilities. Deep dive into Amazon CodeGuru and...
Revolutionize DevOps with ML capabilities. Deep dive into Amazon CodeGuru and...
 
Amazon DevOps Guru for the Serverless Applications at AWS Community Day Bene...
Amazon DevOps Guru for the Serverless Applications at  AWS Community Day Bene...Amazon DevOps Guru for the Serverless Applications at  AWS Community Day Bene...
Amazon DevOps Guru for the Serverless Applications at AWS Community Day Bene...
 
Amazon CodeGuru vs SonarQube for Java Developers at JCon 2022
Amazon CodeGuru vs SonarQube for Java Developers at JCon 2022Amazon CodeGuru vs SonarQube for Java Developers at JCon 2022
Amazon CodeGuru vs SonarQube for Java Developers at JCon 2022
 
Adopting Java for the Serverless World at JUG Saxony Day 2022
Adopting Java for the Serverless World at JUG Saxony Day 2022Adopting Java for the Serverless World at JUG Saxony Day 2022
Adopting Java for the Serverless World at JUG Saxony Day 2022
 
Projects Valhalla and Loom DWX 2022
Projects Valhalla and Loom DWX 2022Projects Valhalla and Loom DWX 2022
Projects Valhalla and Loom DWX 2022
 
Adopting Java for the Serverless World at VoxxedDays Luxemburg
Adopting Java for the Serverless World at VoxxedDays LuxemburgAdopting Java for the Serverless World at VoxxedDays Luxemburg
Adopting Java for the Serverless World at VoxxedDays Luxemburg
 
Revolutionize DevOps with ML capabilities. Introduction to Amazon CodeGuru an...
Revolutionize DevOps with ML capabilities. Introduction to Amazon CodeGuru an...Revolutionize DevOps with ML capabilities. Introduction to Amazon CodeGuru an...
Revolutionize DevOps with ML capabilities. Introduction to Amazon CodeGuru an...
 
Adopting Java for the Serverless World at JUG Bonn 2022
Adopting Java for the Serverless World at JUG Bonn 2022Adopting Java for the Serverless World at JUG Bonn 2022
Adopting Java for the Serverless World at JUG Bonn 2022
 
Adopting Java for the Serverless World at JUG Darmstadt 2022
Adopting Java for the Serverless World at JUG Darmstadt 2022Adopting Java for the Serverless World at JUG Darmstadt 2022
Adopting Java for the Serverless World at JUG Darmstadt 2022
 

Recently uploaded

TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc
 
Microsoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - QuestionnaireMicrosoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - QuestionnaireExakis Nelite
 
ChatGPT and Beyond - Elevating DevOps Productivity
ChatGPT and Beyond - Elevating DevOps ProductivityChatGPT and Beyond - Elevating DevOps Productivity
ChatGPT and Beyond - Elevating DevOps ProductivityVictorSzoltysek
 
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...ScyllaDB
 
State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!Memoori
 
Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on ThanabotsContinuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on ThanabotsLeah Henrickson
 
AI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAnitaRaj43
 
JavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate GuideJavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate GuidePixlogix Infotech
 
Introduction to FIDO Authentication and Passkeys.pptx
Introduction to FIDO Authentication and Passkeys.pptxIntroduction to FIDO Authentication and Passkeys.pptx
Introduction to FIDO Authentication and Passkeys.pptxFIDO Alliance
 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard37
 
WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024Lorenzo Miniero
 
Introduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMIntroduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMKumar Satyam
 
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...panagenda
 
Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)
Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)
Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)Paige Cruz
 
UiPath manufacturing technology benefits and AI overview
UiPath manufacturing technology benefits and AI overviewUiPath manufacturing technology benefits and AI overview
UiPath manufacturing technology benefits and AI overviewDianaGray10
 
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider  Progress from Awareness to Implementation.pptxTales from a Passkey Provider  Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider Progress from Awareness to Implementation.pptxFIDO Alliance
 
CORS (Kitworks Team Study 양다윗 발표자료 240510)
CORS (Kitworks Team Study 양다윗 발표자료 240510)CORS (Kitworks Team Study 양다윗 발표자료 240510)
CORS (Kitworks Team Study 양다윗 발표자료 240510)Wonjun Hwang
 
The Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightThe Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightSafe Software
 
Cyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptx
Cyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptxCyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptx
Cyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptxMasterG
 

Recently uploaded (20)

Overview of Hyperledger Foundation
Overview of Hyperledger FoundationOverview of Hyperledger Foundation
Overview of Hyperledger Foundation
 
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
 
Microsoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - QuestionnaireMicrosoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - Questionnaire
 
ChatGPT and Beyond - Elevating DevOps Productivity
ChatGPT and Beyond - Elevating DevOps ProductivityChatGPT and Beyond - Elevating DevOps Productivity
ChatGPT and Beyond - Elevating DevOps Productivity
 
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
 
State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!
 
Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on ThanabotsContinuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
 
AI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by Anitaraj
 
JavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate GuideJavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate Guide
 
Introduction to FIDO Authentication and Passkeys.pptx
Introduction to FIDO Authentication and Passkeys.pptxIntroduction to FIDO Authentication and Passkeys.pptx
Introduction to FIDO Authentication and Passkeys.pptx
 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptx
 
WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024
 
Introduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMIntroduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDM
 
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
 
Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)
Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)
Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)
 
UiPath manufacturing technology benefits and AI overview
UiPath manufacturing technology benefits and AI overviewUiPath manufacturing technology benefits and AI overview
UiPath manufacturing technology benefits and AI overview
 
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider  Progress from Awareness to Implementation.pptxTales from a Passkey Provider  Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
 
CORS (Kitworks Team Study 양다윗 발표자료 240510)
CORS (Kitworks Team Study 양다윗 발표자료 240510)CORS (Kitworks Team Study 양다윗 발표자료 240510)
CORS (Kitworks Team Study 양다윗 발표자료 240510)
 
The Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightThe Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and Insight
 
Cyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptx
Cyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptxCyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptx
Cyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptx
 

"Reactive Programming in Java" at CamelCaseCon 2018 by Vadym Kazulkin/Rodion Alukhanov

  • 2. Conta ct Vadym Kazulkin, ip.labs GmbH: v.kazulkin@iplabs.de www.xing.com/profile/Vadym_Kazulkin @VKazulkin Rodion Alukhanov, ip.labs GmbH : r.alukhanov@iplabs.de www.xing.com/profile/Rodion_Alukhanov
  • 3. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH ip.labsGmbH
  • 4. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH Agenda • Reactive Programming in general • Reactive Streams and JDK 9 Flow API • RxJava 2 • Spring Reactor 3 • Demo of reactive application with Spring 5, Spring Boot 2, Netty, MongoDB and Thymeleaf technology stack
  • 5. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH Reactive Streams
  • 6. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH Subscriber/Publisher
  • 7. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH Subscription
  • 8. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH Publisher Implementations
  • 9. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH RxJava 2
  • 10. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH public List<Photo> getPhotos() { List<Photo> result = … while (...) { result.add(...); } return result; } Observable<Photo> publisher = Observable.create(subscriber -> { while (...) { Photo photo = ... subscriber.doNext(photo); } subscriber.onCompleted(); }); Classic vs. Reactive (Cold Publisher) for (Item item : getPhoto()) { System.out.println(item.toString()); } publisher.subscribe(item->{ System.out.println(item.toString()); });
  • 11. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH RxJava 2 Basics Observable<Customer> customers = ... Observable<Customer> adults = customers.filter(c -> c.age > 18); Observable<Address> addresses = adults.map(c -> c.getDefaultAddress()); Observable<Order> orders = customers.flatMap(c -> Observable.fromArray(c.getOrders()) ); Observable<Picture> uploadedPhotos = customers.flatMap(c -> Observable.fromArray(dao.loadPhotosByCustomer(c.getId())) );
  • 12. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH Example. Print Photo Book Fetching photo IDs from photo-book Loading meta data from database (ID, Dimentions, Source etc.) Loading images from server HDD if avaliable Loading missing images from source (for example Cloud Service) Validating images + User authentication & authorisation 0ms 10x100ms 90x50ms 10x500ms 100x50ms max500ms
  • 13. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH Loading Meta Data. Buffer. Observable<Integer> ids = Observable.fromIterable(book.getPhotoIDs()); Observable<List<Integer>> idBatches = ids.buffer(10); Observable<MetaData> metadata = idBatches.flatMap(ids -> metadataDao.loadingMetadata(ids));
  • 14. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH Loading Picture from HDD. FlatMap with at most a single result Observable<PictureFile> fromDisk = ids.flatMap(id -> loadingFromDisk(id)); public Observable<PictureFile> loadingFromDisk(Integer id) { Observable<PictureFile> result = Observable.create(s -> { try { s.onNext(pictureDao.loadFromHdd(id)); } catch (PictureNotFound e) { System.out.println("Not found on disk " + id); } s.onComplete(); } return result; }
  • 15. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH Loading from Cloud. Filter Observable<PictureFile> fromCloud = metadata.filter(m->m.isFromCloud()) .flatMap(id -> loadingFromCloud(id.id)); metadata 1 metadata 2 metadata 3 metadata 4 metadata 5 disk-file 1 disk-file 2 disk-file 4 cloud-file 3 cloud-file 5
  • 16. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH Merging Cloud and HDD Observable<PictureFile> allPictures = fromDisk.mergeWith(fromCloud); metadata 1 metadata 2 metadata 3 metadata 4 metadata 5 disk-file 1 cloud-file 3 disk-file 2 disk-file 4 cloud-file 5
  • 17. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH Joining Metadata with Picture Files Observable<Pair<MetaData, PictureFile>> pairs = metadata.join(allPictures, ..., Pair::of); metadata 1 + disk-file 1 metadata 2 + disk-file 1 metadata 3 + disk-file 1 metadata 2 + disk-file 2 metadata 3 + cloud-file 3 pairs = pairs.filter(p->p.fst.id == p.snd.id)
  • 18. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH Observable<Picture> pictures = pairs.map(p->new Picture(p.snd, p.fst)); Joining Metadata with Picture Files
  • 19. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH Validating Result Observable<Picture> validated = pictures.flatMap(p→validation(p)); public static Observable<Picture> validation(Picture p) { return Observable.<Picture>create(s -> { // do the job s.onNext(p); s.onComplete(); }); } Observable<Picture> validated = pictures.map(p→validation2(p)); public static Picture validation2(Picture p) { // do the job return p; }
  • 20. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH Adding Authentication Observable<Boolean> auth = auth(); Observable<Picture> result = Observable.combineLatest(auth, validated, (a,p)->p);
  • 21. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH Back in the „Real World“ result.blockingForEach((item)->{ System.out.println("FINISHED -> " + item.id); });
  • 22. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH Reactive Code Observable<Integer> ids = loadingIds(); Observable<MetaData> metadata = ids.buffer(10).flatMap(id -> loadingMetadata(id)); Observable<PictureFile> fromDisk = ids.flatMap(id -> loadingFromDisk(id)); Observable<PictureFile> fromCloud = metadata.filter(m->m.cloud). flatMap(id -> loadingFromCloud(id.id)); Observable<PictureFile> allPictures = fromDisk.mergeWith(fromCloud); Observable<Long> wait = Observable.never(); Observable<Pair<MetaData, PictureFile>> pairs = metadata.join(allPictures, (m)-> wait, (f)-> wait, Pair::of); Observable<Picture> pictures = pairs.filter(p->p.fst.id == p.snd.id).map(p->new Picture(p.snd, p.fst)); Observable<Picture> validated = pictures.flatMap(p->validation(p)); Observable<Boolean> auth = auth(); Observable<Pair<Boolean, Picture>> result = Observable.combineLatest(auth, validated,(a,p)->p);
  • 23. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH Where is Concurrency? private Scheduler scheduler = Schedulers.io(); public Observable<PictureFile> loadingFromDisk(Integer id) { Observable<PictureFile> result = Observable.create(s -> { try { s.onNext(pictureDao.loadFromHdd(id)); } catch (PictureNotFound e) { System.out.println("Not found on disk " + id); } s.onComplete(); } return result.subscribeOn(scheduler); }
  • 24. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH Observable<Integer> ids = loadingIds(); Observable<MetaData> metadata = ids.buffer(10).flatMap(id -> loadingMetadata(id)); Observable<PictureFile> fromDisk = ids.flatMap(id -> loadingFromDisk(id)); Observable<PictureFile> fromCloud = metadata.filter(m->m.cloud). flatMap(id -> loadingFromCloud(id.id)); Observable<PictureFile> allPictures = fromDisk.mergeWith(fromCloud); Observable<Long> wait = Observable.interval(1000, TimeUnit.SECONDS); Observable<Pair<MetaData, PictureFile>> pairs = metadata.join(allPictures, (m)-> wait, (f)-> wait, Pair::of); Observable<Picture> pictures = pairs.filter(p->p.fst.id == p.snd.id).map(p->new Picture(p.snd, p.fst)); Observable<Picture> validated = pictures.flatMap(p->validation(p)); Observable<Boolean> auth = auth(); Observable<Pair<Boolean, Picture>> result = Observable.combineLatest(auth, validated, Pair::of); Compare Results Classic -> 20 sec Reactor -> 1 sec
  • 25. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH SpringReactor 3
  • 26. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH SpringReactor Timeline
  • 27. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH SpringReactor 3BigPicture
  • 28. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH ReactiveStreamInterfaces
  • 29. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH Spring Reactor 3 Main Types Flux implements Publisher is capable of emitting of 0 or more items
  • 30. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH Spring Reactor 3 Main Types Mono implements Publisher can emit at most once item
  • 31. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH Spring Reactor 3 Examples Publisher creation Flux<String> productTitles = Flux.just("Print 9x13", "Photobook A4", "Calendar A4"); Mono<String> productTitles = Mono.just("Print 9x13"); Flux<String> productTitles = Flux.fromIterable(Arrays.asList("Print 9x13", "Photobook A4", "Calendar A4")); Flux<String> productTitles = Flux.fromArray(new String[]{"Print 9x13", "Photobook A4", "Calendar A4"}); Flux<String> productTitles = Flux.fromStream(Stream.of("Print 9x13", "Photobook A4", "Calendar A4“)); Mono.fromCallable(), Mono.fromRunnable(), Mono.fromFuture() Flux.empty(), Mono.empty(), Flux.error(), Mono.error()
  • 32. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH Spring Reactor 3 Examples Event subscription Flux<String> productTitles = Flux.just("Print 9x13", "Photobook A4", "Calendar A4"); productTitles.subscribe(System.out::println); Output: Print 9x13 Photobook A4 Calendar A4
  • 33. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH Spring Reactor 3 Examples Logging Flux<String> productTitles = Flux.just("Print 9x13", "Photobook A4", "Calendar A4"); productTitles.log().subscribe(System.out::println); Output: INFO reactor.Flux.Array.2 - | onSubscribe() INFO reactor.Flux.Array.2 - | request(unbounded) INFO reactor.Flux.Array.2 - | onNext(Print 9x13) Print 9x13 INFO reactor.Flux.Array.2 - | onNext(Photobook A4) Photobook A4 INFO reactor.Flux.Array.2 - | onNext(Calendar A4) Calendar A4 INFO reactor.Flux.Array.2 - | onComplete()
  • 34. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH ReactiveStreamInterfaces
  • 35. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH Spring Reactor 3 Examples Event subscription with own Subscriber Flux<String> productTitles = Flux.just("Print 9x13", "Photobook A4", "Calendar A4"); productTitles.subscribe(new Subscriber<String>() { @Override public void onSubscribe(Subscription s) { s.request(Long.MAX_VALUE); } @Override public void onNext(String t) { System.out.println(t); } @Override public void onError(Throwable t) { } @Override public void onComplete() { } });
  • 36. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH Spring Reactor 3 Examples Event subscription with custom Subscriber with back-pressure Flux<String> productTitles = Flux.just("Print 9x13", "Photobook A4", "Calendar A4"); productTitles.subscribe(new Subscriber<String>() { private long count = 0; private Subscription subscription; public void onSubscribe(Subscription subscription) { this.subscription = subscription; subscription.request(2); } public void onNext(String t) { count++; if (count>=2) { count = 0; subscription.request(2); } } ...
  • 37. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH Spring Reactor 3 Examples Event subscription with custom Subscriber with back-pressure Flux<String> productTitles = Flux.just("Print 9x13", "Photobook A4", "Calendar A4"); productTitles.log().subscribe(new Subscriber<String>() {subscription.request(2);..} Output: INFO reactor.Flux.Array.2 - | onSubscribe() INFO reactor.Flux.Array.2 - | request(2) INFO reactor.Flux.Array.2 - | onNext(Print 9x13) Print 9x13 INFO reactor.Flux.Array.2 - | onNext(Photobook A4) Photobook A4 INFO reactor.Flux.Array.2 - | request(2) INFO reactor.Flux.Array.2 - | onNext(Calendar A4) Calendar A4 INFO reactor.Flux.Array.2 - | onComplete()
  • 38. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH Spring Reactor 3 Operations Transforming (map, scan) Combining (merge, startWith) Filtering (last, skip) Mathematical (count, average, max) Boolean (every, some, includes) Source: http://rxmarbles.com
  • 39. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH Spring Reactor 3 Examples Elements filtering Flux<String> productTitles = Flux.just("Print 9x13", "Photobook A4", "Calendar A4"); Flux<String> productTitlesStartingWithP = productTitles.filter(productTitle-> productTitle.startsWith("P")); productTitlesStartingWithP.subscribe(System.out::println); Output: Print 9x13 Photobook A4
  • 40. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH Spring Reactor 3 Examples Elements counter Flux<String> productTitles = Flux.just("Print 9x13", "Photobook A4", "Calendar A4"); Mono<Long> productTitlesCount = productTitles.count(); productTitlesCount.subscribe(System.out::println); Output: 3
  • 41. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH Spring Reactor 3 Examples Check if all elements match a condition Flux<String> productTitles = Flux.just("Print 9x13", "Photobook A4", "Calendar A4"); Mono<Boolean> allProductTitlesLengthBiggerThan5= productTitles.all(productTitle-> productTitle.length() > 5); allProductTitlesLengthBiggerThan5.subscribe(System.out::println); Output: true
  • 42. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH Spring Reactor 3 Examples Element mapping Flux<String> productTitles = Flux.just("Print 9x13", "Photobook A4", "Calendar A4"); Flux<Integer> productTitlesLength = productTitles.map(productTitle-> productTitle.length()) ; productTitlesLength.subscribe(System.out::println); Output: 10 12 11
  • 43. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH Spring Reactor 3 Examples Zipping of 2 Publishers Flux<String> productTitles = Flux.just("Print 9x13", "Photobook A4", "Calendar A4"); Flux<Double> productPrices = Flux.fromIterable(Arrays.asList(0.09, 29.99, 15.99)); Flux<Tuple2<String, Double>> zippedFlux = Flux.zip(productTitles, productPrices); zippedFlux.subscribe(System.out::println); Output: [Print 9x13,0.09] [Photobook A4,29.99] [Calendar A4,15.99]
  • 44. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH Spring Reactor 3 Examples Parallel processing Flux<String> productTitles = Flux.just("Print 9x13", "Photobook A4", "Calendar A4"); Flux<Double> productPrices = Flux.fromIterable(Arrays.asList(0.09, 29.99, 15.99)); Flux.zip(productTitles, productPrices) .parallel() //returns ParallelFlux, uses all available CPUs or call parallel(numberOfCPUs) .runOn(Schedulers.parallel()) .sequential() .subscribe(System.out::println); Output: [Print 9x13,0.09] [Photobook A4,29.99] [Calendar A4,15.99]
  • 45. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH Spring Reactor 3 Examples Blocking Publisher BlockingFlux: Flux<String> productTitles = Flux.just("Print 9x13", "Photobook A4", "Calendar A4"); Iterable<String> blockingConcatProductTitles = productTitles.concatWith(anotherProductTitle) .toIterable(); or Stream<String> blockingConcatProductTitles = productTitles.concatWith(anotherProductTitle) .toStream(); BlockingMono: String blockingProductTitles = Mono.just("Print 9x13") .block(); or CompletableFuture blockingProductTitles = Mono.just("Print 9x13").toFuture();
  • 46. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH LMAX Disruptor RingBuffer withmultipleproducersandconsumers Source: https://github.com/LMAX-Exchange/disruptor/wiki/Introduction
  • 47. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH Spring Reactor 3 Examples Test the publishers Flux<String> productTitles = Flux.just("Print 9x13", "Photobook A4", "Calendar A4"); Duration verificationDuration = StepVerifier.create(productTitles). expectNextMatches(productTitle -> productTitle.equals("Print 9x13")). expectNextMatches(productTitle -> productTitle.equals("Photobook A4")). expectNextMatches(productTitle -> productTitle.equals("Calendar A4")). expectComplete(). verify());
  • 48. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH Spring Reactor 3 Examples Test the publishers Flux<String> productTitles = Flux.just("Print 9x13", "Photobook A4", "Calendar A4"); StepVerifier.create(productTitles). expectNextMatches(productTitle -> productTitle.equals("Print 9x13")). expectNextMatches(productTitle -> productTitle.equals("Photobook A4")). expectNextMatches(productTitle -> productTitle.equals("Calendar A4")). expectComplete(). verify()) Output: Exception in thread "main" java.lang.AssertionError: expectation "expectComplete" failed (expected: onComplete(); actual: onNext(Calendar A4));
  • 49. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH Spring 5 / Spring Boot 2 / Netty / MongoDB / Thymeleaf Demo
  • 50. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH Spring5/ SpringWebReactive
  • 51. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH Spring5/ SpringWebReactive
  • 52. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH Spring5/ SpringWebReactive
  • 53. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH Dependencies
  • 54. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH Non-blockingNettyWebClient
  • 55. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH MongoDB ReactiveDatabaseTemplate
  • 56. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH Model
  • 57. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH Repository
  • 58. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH Thymeleaf ReactiveView Resolver
  • 59. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH Controller
  • 60. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH View
  • 61. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH Non-blockingJSON ParsingwithJackson
  • 62. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH Spring5/ SpringWebReactive
  • 63. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH Functional Endpoint • Alternative to the annotated-based programming (uses the same Reactive Web Spring API) • Lightweight functional programming model • Functions are used to route and handle requests • Contracts are designed for immutability
  • 64. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH Functional Endpoint
  • 65. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH Benefits of the Reactive Applications • Efficient resource utilization (spending less money on servers and data centres) • Processing higher loads with fewer threads Source: https://spring.io/blog/2016/06/07/notes-on-reactive-programming-part-i-the-reactive-landscape
  • 66. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH Uses Cases for Reactive Applications • External service calls • Highly concurrent message consumers • Single page applications with unbounded elements to display
  • 67. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH Pitfalls of reactive programming • For the wrong problem, this makes things worse • Hard to debug (no control over executing thread) • Mistakenly blocking a single request leads to increased latency for all requests -> blocking all requests brings a server to its knees Source: https://spring.io/blog/2016/07/20/notes-on-reactive-programming-part-iii-a-simple-http-server-application
  • 68. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH Questions?
  • 69. Conta ct Vadym Kazulkin, ip.labs GmbH: v.kazulkin@iplabs.de www.xing.com/profile/Vadym_Kazulkin @VKazulkin Rodion Alukhanov, ip.labs GmbH : r.alukhanov@iplabs.de www.xing.com/profile/Rodion_Alukhanov