SlideShare una empresa de Scribd logo
1 de 68
Descargar para leer sin conexión
byVadymKazulkinandRodionAlukhanov, ip.labsGmbH
Reactive Programming in Java
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
RxJava2
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
Fetch photo IDs from Book
Load meta data from Database (ID, Dimentions, Source etc.)
Load images from server HDD if avaliable
Load images from source (for example Cloud Service)
Validate Image
+
User authentication & authorisation
0 ms
10 x 100ms
90 x 50ms
10 x 500ms
100 x 50ms
max 500ms
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();
}
Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH
Loading from Cloud. Filter
Observable<PictureFile> fromCloud =
metadata.filter(m->m.cloud).
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, (m)->lastMeta, (f)->lastFile, 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.filter(p->p.fst.id == p.snd.id).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));
Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH
Adding Authentication
Observable<Boolean> auth = auth();
Observable<Pair<Boolean, Picture>> result =
Observable.combineLatest(auth, validated, Pair::of);
Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH
Back in the Real World
BlockingObservableNext<Pair<Boolean, Picture>> b =
new BlockingObservableNext<>(result);
for (Pair<Boolean, Picture> item : b) {
System.out.println("Finished " + item.snd.id);
}
Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH
Compare Results
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);
ObservableSource<MetaData> lastMeta = (l) -> metadata.takeLast(1);
ObservableSource<PictureFile> lastFile = (l) -> allPictures.takeLast(1);
Observable<Pair<MetaData, PictureFile>> pairs = metadata.join(allPictures, (m)->lastMeta, (f)-
>lastFile, 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();
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
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
Concatenation of 2 Publishers
Flux<String> productTitles = Flux.just("Print 9x13", "Photobook A4", "Calendar A4");
Mono<String> anotherProductTitle=Mono.just("Teddy");
Flux<String> concatProductTitles =
productTitles.concatWith(anotherProductTitle);
concatProductTitles.subscribe(System.out::println);
Output:
Print 9x13
Photobook A4
Calendar A4
Teddy
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
SpringReactor Compatibility toJava9FlowAPI
Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH
RxJava2vsSpringReactor 3
Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH
Comparingreactiveandstreamingimplementations
Source: http://akarnokd.blogspot.de/2016/12/the-reactive-scrabble-benchmarks.html
Source: https://twitter.com/akarnokd/status/808995627237601280
Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH
Thefutureof ReactiveStreamAPIs
4th generation already
5th generation will heavily make use of advanced „operator
fusion“
Source http://akarnokd.blogspot.de/2016/03/operator-fusion-part-1.html
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
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
Testing
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
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
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?
Contact
Vadym Kazulkin :
Email : v.kazulkin@iplabs.de
Xing : https://www.xing.com/profile/Vadym_Kazulkin
Rodion Alukhanov :
Email : r.alukhanov@iplabs.de
Xing : https://www.xing.com/profile/Rodion_Alukhanov
w w w.iplabs.de
Thank You!

Más contenido relacionado

La actualidad más candente

Javascript Everywhere
Javascript EverywhereJavascript Everywhere
Javascript EverywherePascal Rettig
 
Android programming -_pushing_the_limits
Android programming -_pushing_the_limitsAndroid programming -_pushing_the_limits
Android programming -_pushing_the_limitsDroidcon Berlin
 
Reactive programming with RxJava
Reactive programming with RxJavaReactive programming with RxJava
Reactive programming with RxJavaJobaer Chowdhury
 
Introduction to Retrofit and RxJava
Introduction to Retrofit and RxJavaIntroduction to Retrofit and RxJava
Introduction to Retrofit and RxJavaFabio Collini
 
Java libraries you can't afford to miss
Java libraries you can't afford to missJava libraries you can't afford to miss
Java libraries you can't afford to missAndres Almiray
 
The Ring programming language version 1.7 book - Part 75 of 196
The Ring programming language version 1.7 book - Part 75 of 196The Ring programming language version 1.7 book - Part 75 of 196
The Ring programming language version 1.7 book - Part 75 of 196Mahmoud Samir Fayed
 
JavaOne 2013: Java 8 - The Good Parts
JavaOne 2013: Java 8 - The Good PartsJavaOne 2013: Java 8 - The Good Parts
JavaOne 2013: Java 8 - The Good PartsKonrad Malawski
 
Angular Advanced Workshop (+ Challenges)
Angular Advanced Workshop (+ Challenges)Angular Advanced Workshop (+ Challenges)
Angular Advanced Workshop (+ Challenges)Georgios Kaleadis
 
"Quantum" Performance Effects
"Quantum" Performance Effects"Quantum" Performance Effects
"Quantum" Performance EffectsSergey Kuksenko
 
The Ring programming language version 1.8 book - Part 77 of 202
The Ring programming language version 1.8 book - Part 77 of 202The Ring programming language version 1.8 book - Part 77 of 202
The Ring programming language version 1.8 book - Part 77 of 202Mahmoud Samir Fayed
 
Drools, jBPM OptaPlanner presentation
Drools, jBPM OptaPlanner presentationDrools, jBPM OptaPlanner presentation
Drools, jBPM OptaPlanner presentationMark Proctor
 
We Are All Testers Now: The Testing Pyramid and Front-End Development
We Are All Testers Now: The Testing Pyramid and Front-End DevelopmentWe Are All Testers Now: The Testing Pyramid and Front-End Development
We Are All Testers Now: The Testing Pyramid and Front-End DevelopmentAll Things Open
 
MongoDB World 2019: Life In Stitch-es
MongoDB World 2019: Life In Stitch-esMongoDB World 2019: Life In Stitch-es
MongoDB World 2019: Life In Stitch-esMongoDB
 
Synthesizing API Usage Examples
Synthesizing API Usage Examples Synthesizing API Usage Examples
Synthesizing API Usage Examples Ray Buse
 
GWT is Smarter Than You
GWT is Smarter Than YouGWT is Smarter Than You
GWT is Smarter Than YouRobert Cooper
 
Get Back in Control of your SQL with jOOQ - GeekOut by ZeroTurnaround
Get Back in Control of your SQL with jOOQ - GeekOut by ZeroTurnaroundGet Back in Control of your SQL with jOOQ - GeekOut by ZeroTurnaround
Get Back in Control of your SQL with jOOQ - GeekOut by ZeroTurnaroundDataGeekery
 

La actualidad más candente (20)

Javascript Everywhere
Javascript EverywhereJavascript Everywhere
Javascript Everywhere
 
Android programming -_pushing_the_limits
Android programming -_pushing_the_limitsAndroid programming -_pushing_the_limits
Android programming -_pushing_the_limits
 
Reactive programming with RxJava
Reactive programming with RxJavaReactive programming with RxJava
Reactive programming with RxJava
 
Introduction to Retrofit and RxJava
Introduction to Retrofit and RxJavaIntroduction to Retrofit and RxJava
Introduction to Retrofit and RxJava
 
Java libraries you can't afford to miss
Java libraries you can't afford to missJava libraries you can't afford to miss
Java libraries you can't afford to miss
 
The Ring programming language version 1.7 book - Part 75 of 196
The Ring programming language version 1.7 book - Part 75 of 196The Ring programming language version 1.7 book - Part 75 of 196
The Ring programming language version 1.7 book - Part 75 of 196
 
JavaOne 2013: Java 8 - The Good Parts
JavaOne 2013: Java 8 - The Good PartsJavaOne 2013: Java 8 - The Good Parts
JavaOne 2013: Java 8 - The Good Parts
 
Celery
CeleryCelery
Celery
 
Angular Advanced Workshop (+ Challenges)
Angular Advanced Workshop (+ Challenges)Angular Advanced Workshop (+ Challenges)
Angular Advanced Workshop (+ Challenges)
 
"Quantum" Performance Effects
"Quantum" Performance Effects"Quantum" Performance Effects
"Quantum" Performance Effects
 
The Ring programming language version 1.8 book - Part 77 of 202
The Ring programming language version 1.8 book - Part 77 of 202The Ring programming language version 1.8 book - Part 77 of 202
The Ring programming language version 1.8 book - Part 77 of 202
 
Drools, jBPM OptaPlanner presentation
Drools, jBPM OptaPlanner presentationDrools, jBPM OptaPlanner presentation
Drools, jBPM OptaPlanner presentation
 
JDK8: Stream style
JDK8: Stream styleJDK8: Stream style
JDK8: Stream style
 
droidparts
droidpartsdroidparts
droidparts
 
We Are All Testers Now: The Testing Pyramid and Front-End Development
We Are All Testers Now: The Testing Pyramid and Front-End DevelopmentWe Are All Testers Now: The Testing Pyramid and Front-End Development
We Are All Testers Now: The Testing Pyramid and Front-End Development
 
MongoDB World 2019: Life In Stitch-es
MongoDB World 2019: Life In Stitch-esMongoDB World 2019: Life In Stitch-es
MongoDB World 2019: Life In Stitch-es
 
Synthesizing API Usage Examples
Synthesizing API Usage Examples Synthesizing API Usage Examples
Synthesizing API Usage Examples
 
GWT is Smarter Than You
GWT is Smarter Than YouGWT is Smarter Than You
GWT is Smarter Than You
 
Test Time Bombs
Test Time BombsTest Time Bombs
Test Time Bombs
 
Get Back in Control of your SQL with jOOQ - GeekOut by ZeroTurnaround
Get Back in Control of your SQL with jOOQ - GeekOut by ZeroTurnaroundGet Back in Control of your SQL with jOOQ - GeekOut by ZeroTurnaround
Get Back in Control of your SQL with jOOQ - GeekOut by ZeroTurnaround
 

Similar a "Reactive Programming in Java" at Froscon 2017 by Vadym Kazulkin/Rodion Alukhanov

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
 
Building Scalable Stateless Applications with RxJava
Building Scalable Stateless Applications with RxJavaBuilding Scalable Stateless Applications with RxJava
Building Scalable Stateless Applications with RxJavaRick Warren
 
"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
 
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
 
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
 
The Making of the Oracle R2DBC Driver and How to Take Your Code from Synchron...
The Making of the Oracle R2DBC Driver and How to Take Your Code from Synchron...The Making of the Oracle R2DBC Driver and How to Take Your Code from Synchron...
The Making of the Oracle R2DBC Driver and How to Take Your Code from Synchron...VMware Tanzu
 
Apollo. The client we deserve
Apollo. The client we deserveApollo. The client we deserve
Apollo. The client we deserveYuri Nezdemkovski
 
From Java to Kotlin - The first month in practice
From Java to Kotlin - The first month in practiceFrom Java to Kotlin - The first month in practice
From Java to Kotlin - The first month in practiceStefanTomm
 
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
 
Object detection
Object detectionObject detection
Object detectionSomesh Vyas
 
The curious Life of JavaScript - Talk at SI-SE 2015
The curious Life of JavaScript - Talk at SI-SE 2015The curious Life of JavaScript - Talk at SI-SE 2015
The curious Life of JavaScript - Talk at SI-SE 2015jbandi
 
4Developers 2015: Programowanie synchroniczne i asynchroniczne - dwa światy k...
4Developers 2015: Programowanie synchroniczne i asynchroniczne - dwa światy k...4Developers 2015: Programowanie synchroniczne i asynchroniczne - dwa światy k...
4Developers 2015: Programowanie synchroniczne i asynchroniczne - dwa światy k...PROIDEA
 
Phone gap 12 things you should know
Phone gap 12 things you should knowPhone gap 12 things you should know
Phone gap 12 things you should knowISOCHK
 
Integration tests: use the containers, Luke!
Integration tests: use the containers, Luke!Integration tests: use the containers, Luke!
Integration tests: use the containers, Luke!Roberto Franchini
 

Similar a "Reactive Programming in Java" at Froscon 2017 by Vadym Kazulkin/Rodion Alukhanov (20)

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
 
Building Scalable Stateless Applications with RxJava
Building Scalable Stateless Applications with RxJavaBuilding Scalable Stateless Applications with RxJava
Building Scalable Stateless Applications with RxJava
 
"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 ...
 
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...
 
It's always your fault
It's always your faultIt's always your fault
It's always your fault
 
Open sourcing the store
Open sourcing the storeOpen sourcing the store
Open sourcing the store
 
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...
 
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...
 
The Making of the Oracle R2DBC Driver and How to Take Your Code from Synchron...
The Making of the Oracle R2DBC Driver and How to Take Your Code from Synchron...The Making of the Oracle R2DBC Driver and How to Take Your Code from Synchron...
The Making of the Oracle R2DBC Driver and How to Take Your Code from Synchron...
 
Apollo. The client we deserve
Apollo. The client we deserveApollo. The client we deserve
Apollo. The client we deserve
 
From Java to Kotlin - The first month in practice
From Java to Kotlin - The first month in practiceFrom Java to Kotlin - The first month in practice
From Java to Kotlin - The first month in practice
 
Java 6 [Mustang] - Features and Enchantments
Java 6 [Mustang] - Features and Enchantments Java 6 [Mustang] - Features and Enchantments
Java 6 [Mustang] - Features and Enchantments
 
Object detection
Object detectionObject detection
Object detection
 
The curious Life of JavaScript - Talk at SI-SE 2015
The curious Life of JavaScript - Talk at SI-SE 2015The curious Life of JavaScript - Talk at SI-SE 2015
The curious Life of JavaScript - Talk at SI-SE 2015
 
4Developers 2015: Programowanie synchroniczne i asynchroniczne - dwa światy k...
4Developers 2015: Programowanie synchroniczne i asynchroniczne - dwa światy k...4Developers 2015: Programowanie synchroniczne i asynchroniczne - dwa światy k...
4Developers 2015: Programowanie synchroniczne i asynchroniczne - dwa światy k...
 
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
 
Phone gap 12 things you should know
Phone gap 12 things you should knowPhone gap 12 things you should know
Phone gap 12 things you should know
 
Integration tests: use the containers, Luke!
Integration tests: use the containers, Luke!Integration tests: use the containers, Luke!
Integration tests: use the containers, Luke!
 
Introduction to Jooq
Introduction to JooqIntroduction to Jooq
Introduction to Jooq
 
Play framework
Play frameworkPlay framework
Play framework
 

Más de 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
 

Más de 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
 

Último

08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdfChristopherTHyatt
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 

Último (20)

08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 

"Reactive Programming in Java" at Froscon 2017 by Vadym Kazulkin/Rodion Alukhanov

  • 2. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH ip.labsGmbH ●
  • 3. 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
  • 4. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH Reactive Streams
  • 5. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH Subscriber/Publisher
  • 6. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH Subscription
  • 7. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH Publisher Implementations
  • 8. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH RxJava2
  • 9. 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()); });
  • 10. 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())) );
  • 11. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH Example. Print Photo Book Fetch photo IDs from Book Load meta data from Database (ID, Dimentions, Source etc.) Load images from server HDD if avaliable Load images from source (for example Cloud Service) Validate Image + User authentication & authorisation 0 ms 10 x 100ms 90 x 50ms 10 x 500ms 100 x 50ms max 500ms
  • 12. 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));
  • 13. 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(); }
  • 14. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH Loading from Cloud. Filter Observable<PictureFile> fromCloud = metadata.filter(m->m.cloud). 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
  • 15. 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
  • 16. 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, (m)->lastMeta, (f)->lastFile, 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)
  • 17. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH Observable<Picture> pictures = pairs.filter(p->p.fst.id == p.snd.id).map(p->new Picture(p.snd, p.fst)); Joining Metadata with Picture Files
  • 18. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH Validating Result Observable<Picture> validated = pictures.flatMap(p- >validation(p));
  • 19. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH Adding Authentication Observable<Boolean> auth = auth(); Observable<Pair<Boolean, Picture>> result = Observable.combineLatest(auth, validated, Pair::of);
  • 20. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH Back in the Real World BlockingObservableNext<Pair<Boolean, Picture>> b = new BlockingObservableNext<>(result); for (Pair<Boolean, Picture> item : b) { System.out.println("Finished " + item.snd.id); }
  • 21. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH Compare Results 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); ObservableSource<MetaData> lastMeta = (l) -> metadata.takeLast(1); ObservableSource<PictureFile> lastFile = (l) -> allPictures.takeLast(1); Observable<Pair<MetaData, PictureFile>> pairs = metadata.join(allPictures, (m)->lastMeta, (f)- >lastFile, 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(); Classic -> 20 sec Reactor -> 1 sec
  • 22. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH SpringReactor 3
  • 23. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH SpringReactor Timeline ●
  • 24. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH SpringReactor 3BigPicture
  • 25. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH ReactiveStreamInterfaces
  • 26. 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
  • 27. 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
  • 28. 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()
  • 29. 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
  • 30. 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()
  • 31. 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() { } });
  • 32. 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); } } ...
  • 33. 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()
  • 34. 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
  • 35. 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
  • 36. 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
  • 37. 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
  • 38. 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
  • 39. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH Spring Reactor 3 Examples Concatenation of 2 Publishers Flux<String> productTitles = Flux.just("Print 9x13", "Photobook A4", "Calendar A4"); Mono<String> anotherProductTitle=Mono.just("Teddy"); Flux<String> concatProductTitles = productTitles.concatWith(anotherProductTitle); concatProductTitles.subscribe(System.out::println); Output: Print 9x13 Photobook A4 Calendar A4 Teddy
  • 40. 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]
  • 41. 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]
  • 42. 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();
  • 43. 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
  • 44. 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());
  • 45. 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));
  • 46. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH SpringReactor Compatibility toJava9FlowAPI
  • 47. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH RxJava2vsSpringReactor 3
  • 48. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH Comparingreactiveandstreamingimplementations Source: http://akarnokd.blogspot.de/2016/12/the-reactive-scrabble-benchmarks.html Source: https://twitter.com/akarnokd/status/808995627237601280
  • 49. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH Thefutureof ReactiveStreamAPIs 4th generation already 5th generation will heavily make use of advanced „operator fusion“ Source http://akarnokd.blogspot.de/2016/03/operator-fusion-part-1.html
  • 50. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH Spring 5 / Spring Boot 2 / Netty / MongoDB / Thymeleaf Demo
  • 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 Testing
  • 63. 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
  • 64. 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 Source: https://spring.io/blog/2016/06/07/notes-on-reactive-programming-part-i-the-reactive-landscape
  • 65. 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
  • 66. Reactive Programming in Java by Vadym Kazulkin and Rodion Alukhanov, ip.labs GmbH Questions?
  • 67. Contact Vadym Kazulkin : Email : v.kazulkin@iplabs.de Xing : https://www.xing.com/profile/Vadym_Kazulkin Rodion Alukhanov : Email : r.alukhanov@iplabs.de Xing : https://www.xing.com/profile/Rodion_Alukhanov