SlideShare a Scribd company logo
1 of 59
Download to read offline
November 16, 2018
BGOUG Autumn Conference
Reactive Java
for The Realtime
Trayan Iliev
tiliev@iproduct.org
http://iproduct.org
Copyright © 2003-2018 IPT - Intellectual
Products & Technologies
2
Reactive Javafor The Realtime
 Java data streaming for the (soft) realtime applicatins
 Async programming alternatives
 Introduction to FRP, Reactive Streams spec
 RxJava Project Reactor
 REST services with JAX-RS and Reactor
 End-to-end non-blocking reactive SOA with Netty
 Realtime event streaming to JS clients using SSE
 IoT event streaming demo
3
Reactive Javafor The Realtime
 Java data streaming for the (soft) realtime applicatins
 Async programming alternatives
 Introduction to FRP, Reactive Streams spec
 RxJava Project Reactor
 REST services with JAX-RS and Reactor
 End-to-end non-blocking reactive SOA with Netty
 Realtime event streaming to JS clients using SSE
 IoT event streaming demo
Best Explained in Code
About me
4
Trayan Iliev
– CEO of IPT – Intellectual Products &
Technologies (http://iproduct.org/)
– Oracle®
certified programmer 15+ Y
– end-to-end reactive fullstack apps with Java,
ES6/7, TypeScript, Angular, React and Vue.js
– 12+ years IT trainer
– Voxxed Days, jPrime, jProfessionals,
BGOUG, BGJUG, DEV.BG speaker
– Organizer RoboLearn hackathons and IoT
enthusiast (http://robolearn.org)
5
Since 2003: IT Education Evolved. Courses:
 Java SE/Web/EE, JPA / Hibernate, Spring 5
 Reactive event stream processing with Reactor /
RxJava / RxJS
 Node.js + Express + React + Redux + GraphQL
 Angular + TypeScript + GraphQL
 SOA & REST HATEOAS
 DDD & Reactive Microservices
IPT - Intellectual Products & Technologies
http://www.iproduct.org
Where to Find the Demo Code?
6
Reactive IoT demos available @ GitHub:
https://github.com/iproduct/reactive-demos-iot
YouTube Video for the IoT demo:
https://www.youtube.com/watch?v=AB3AWAfcy9U
Data / Event / Message Streams
7
“Conceptually, a stream is a (potentially never-ending)
flow of data records, and a transformation is an
operation that takes one or more streams as input,
and produces one or more output streams as a
result.”
Apache Flink: Dataflow Programming Model
Data Stream Programming
8
The idea of abstracting logic from execution is hardly
new -- it was the dream of SOA. And the recent
emergence of microservices and containers shows that
the dream still lives on.
For developers, the question is whether they want to
learn yet one more layer of abstraction to their coding.
On one hand, there's the elusive promise of a common
API to streaming engines that in theory should let you
mix and match, or swap in and swap out.
Tony Baer (Ovum) @ ZDNet - Apache Beam and Spark:
New coopetition for squashing the Lambda Architecture?
Realtime Event Processing
9
Distributed realtime event processing becomes a hot
topic:
 IoT,
 Service/process monitoring,
 Realtime analytics, fraud detection
 Click stream analytics
 Stock-trading analysis
 Supply chain and transportation alerts
 ...
Lambda Architecture - I
10
https://commons.wikimedia.org/w/index.php?curid=34963986, By Textractor - Own work, CC BY-SA 4
Lambda Architecture - II
11
https://commons.wikimedia.org/w/index.php?curid=34963987, By Textractor - Own work, CC BY-SA 4
Lambda Architecture - III
12
 Data-processing architecture designed to handle
massive quantities of data by using both batch- and
stream-processing methods
 Balances latency, throughput, fault-tolerance, big
data, real-time analytics, mitigates the latencies of
map-reduce
 Data model with an append-only, immutable data
source that serves as a system of record
 Ingesting and processing timestamped events that are
appended to existing events. State is determined from
the natural time-based ordering of the data.
Lambda Architecture: Projects - I
13
 Apache Spark is an open-source
cluster-computing framework. Spark
Streaming, Spark Mllib
 Apache Storm is a distributed
stream processing – streams DAG
 Apache Apex™ unified stream and
batch processing engine.
Lambda Architecture: Projects - II
 Apache Flink - open source stream
processing framework – Java, Scala
 Apache Kafka - open-source stream
processing (Kafka Streams), real-
time, low-latency, high-throughput,
massively scalable pub/sub
 Apache Beam – unified batch and
streaming, portable, extensible
Direct Acyclic Graphs - DAG
15
Synchronous vs. Asynchronous IO
16
DB
Synchronous
A
A
B
B
DB
Asynchronous
A
B
C
D
A
B
C
D
Example: Internet of Things (IoT)
17
CC BY 2.0, Source:
https://www.flickr.com/photos/wilgengebroed/8249565455/
Radar, GPS, lidar for navigation and obstacle
avoidance ( 2007 DARPA Urban Challenge )
IoT Services Architecture
18
Devices: Hardware + Embedded Software + Firmware
UART/ I2C/ 2G/ 3G/ LTE/ ZigBee/ 6LowPan/ BLE
Aggregation/ Bus: ESB, Message Broker
Device Gateway: Local Coordination and Event Aggregation
M2M: HTTP(/2) / WS / MQTT / CoAP
Management: TR-069 / OMA-DM / OMA LWM2M
HTTP, AMQP
Cloud (Micro)Service Mng.
Docker, Kubernetes/
Apache Brooklyn
Web/ Mobile
Portal
PaaSDashboard
PaaS API: Event Processing Services, Analytics
19
 Performance is about 2 things (Martin Thompson –
http://www.infoq.com/articles/low-latency-vp ):
– Throughput – units per second, and
– Latency – response time
 Real-time – time constraint from input to response
regardless of system load.
 Hard real-time system if this constraint is not honored then
a total system failure can occur.
 Soft real-time system – low latency response with little
deviation in response time
 100 nano-seconds to 100 milli-seconds. [Peter Lawrey]
What's High Performance?
20
 Callbacks – asynchronous methods do not have a return value but take
an extra callback parameter (a lambda or anonymous class) that gets
called when the result is available. Ex.: Swing’s EventListener
 Futures, Promises – asynchronous methods return a
(Completable)Future<T> immediately. The value is not immediately
available, and the object can be polled Ex.: Callable<T> task
 Reactive Streams (functional, non-blocking) – Observable (RxJava),
Flowable (RxJava2), Flux & Mono (Project Reactor):
 Composability and readability
 Data as a flow manipulated with a rich vocabulary of operators
 Lazy evaluation – nothing happens until you subscribe ()
 Backpressure – consumer can signal to producer that the rate is high
 High level but high value abstraction that is concurrency-agnostic
How to Do Async Programming?
Source: https://projectreactor.io/docs/core/release/reference
Futures in Java 8 - I
21
 Future (implemented by FutureTask) – represents the
result of an cancelable asynchronous computation.
Methods are provided to check if the computation is
complete, to wait for its completion, and to retrieve the
result of the computation (blocking till its ready).
 RunnableFuture – a Future that is Runnable.
Successful execution of the run method causes Future
completion, and allows access to its results.
 ScheduledFuture – delayed cancelable action that
returns result. Usually a scheduled future is the result
of scheduling a task with a ScheduledExecutorService
Future Use Example
22
Future<String> future = executor.submit(
new Callable<String>() {
public String call() {
return searchService.findByTags(tags);
}
}
);
DoSomethingOther();
try {
showResult(future.get()); // use future result
} catch (ExecutionException ex) { cleanup(); }
Futures in Java 8 - II
23
 CompletableFuture – a Future that may be explicitly
completed (by setting its value and status), and may
be used as a CompletionStage, supporting dependent
functions and actions that trigger upon its completion.
 CompletionStage – a stage of possibly asynchronous
computation, that is triggered by completion of
previous stage or stages (CompletionStages form
Direct Acyclic Graph – DAG). A stage performs an
action or computes value and completes upon
termination of its computation, which in turn triggers
next dependent stages. Computation may be Function
(apply), Consumer (accept), or Runnable (run).
CompletableFuture Example - I
24
private CompletableFuture<String>
longCompletableFutureTask(int i, Executor executor) {
return CompletableFuture.supplyAsync(() -> {
try {
Thread.sleep(1000); // long computation :)
} catch (InterruptedException e) {
e.printStackTrace();
}
return i + "-" + "test";
}, executor);
}
CompletableFuture Example - II
25
ExecutorService executor = ForkJoinPool.commonPool();
//ExecutorService executor = Executors.newCachedThreadPool();
public void testlCompletableFutureSequence() {
List<CompletableFuture<String>> futuresList =
IntStream.range(0, 20).boxed()
.map(i -> longCompletableFutureTask(i, executor)
.exceptionally(t -> t.getMessage()))
.collect(Collectors.toList());
CompletableFuture<List<String>> results =
CompletableFuture.allOf(
futuresList.toArray(new CompletableFuture[0]))
.thenApply(v -> futuresList.stream()
.map(CompletableFuture::join)
.collect(Collectors.toList())
);
CompletableFuture Example - III
26
try {
System.out.println(results.get(10, TimeUnit.SECONDS));
} catch (ExecutionException | TimeoutException
| InterruptedException e) {
e.printStackTrace();
}
executor.shutdown();
}
// OR just:
System.out.println(results.join());
executor.shutdown();
Which is better?
CompletionStage
27
 Computation may be Function (apply), Consumer
(accept), or Runnable (run) – e.g.:
completionStage.thenApply( x -> x * x )
.thenAccept(System.out::print )
.thenRun( System.out::println )
 Stage computation can be triggered by completion of
1 (then), 2 (combine), or either 1 of 2 (either)
 Functional composition can be applied to stages
themselves instead to their results using compose
 handle & whenComplete – support unconditional
computation – both normal or exceptional triggering
CompletionStages Composition
28
public void testlCompletableFutureComposition() throws
InterruptedException, ExecutionException {
Double priceInEuro = CompletableFuture.supplyAsync(()
-> getStockPrice("GOOGL"))
.thenCombine(CompletableFuture.supplyAsync(() ->
getExchangeRate(USD, EUR)), this::convertPrice)
.exceptionally(throwable -> {
System.out.println("Error: " +
throwable.getMessage());
return -1d;
}).get();
System.out.println("GOOGL stock price in Euro: " +
priceInEuro );
}
More Demos ...
29
CompletableFuture, Flow & RxJava2 @ GitHub:
https://github.com/iproduct/reactive-demos-java-9
 completable-future-demo – composition, delayed, ...
 flow-demo – custom Flow implementations using CFs
 rxjava2-demo – RxJava2 intro to reactive composition
 completable-future-jaxrs-cdi-cxf – async observers, ...
 completable-future-jaxrs-cdi-jersey
 completable-future-jaxrs-cdi-jersey-client
Ex.1: Async CDI Events with CF
30
@Inject @CpuProfiling private Event<CpuLoad> event; ...
IntervalPublisher.getDefaultIntervalPublisher(
500, TimeUnit.MILLISECONDS) // Custom CF Flow Publisher
.subscribe(new Subscriber<Integer>() {
@Override public void onComplete() {}
@Override public void onError(Throwable t) {}
@Override public void onNext(Integer i) {
event.fireAsync(new CpuLoad(
System.currentTimeMillis(), getJavaCPULoad(),
areProcessesChanged()))
.thenAccept(event -> {
logger.info("CPU load event fired: " + event);
}); } //firing CDI async event returns CF
@Override public void onSubscribe(Subscription
subscription) {subscription.request(Long.MAX_VALUE);} });
Ex.2: Reactive JAX-RS Client - CF
31
CompletionStage<List<ProcessInfo>> processesStage =
processes.request().rx()
.get(new GenericType<List<ProcessInfo>>() {})
.exceptionally(throwable -> {
logger.error("Error: " + throwable.getMessage());
return Collections.emptyList();
});
CompletionStage<Void> printProcessesStage =
processesStage.thenApply(proc -> {
System.out.println("Active JAVA Processes: " + proc);
return null;
});
Ex.2: Reactive JAX-RS Client - CF
32
(- continues -)
printProcessesStage.thenRun( () -> {
try (SseEventSource source =
SseEventSource.target(stats).build()) {
source.register(System.out::println);
source.open();
Thread.sleep(20000); // Consume events for 20 sec
} catch (InterruptedException e) {
logger.info("SSE consumer interrupted: " + e);
}
})
.thenRun(() -> {System.exit(0);});
Listing Favs or Suggestions - Callbacks
33
userService.getFavorites(userId, new Callback<List<String>>() {
public void onSuccess(List<String> list) {
if (list.isEmpty()) {
suggestionService.getSuggestions(new Callback<List<Favorite>>() {
public void onSuccess(List<Favorite> list) {
UiUtils.submitOnUiThread(() -> {
list.stream().limit(5).forEach(uiList::show);}); }
public void onError(Throwable error) { UiUtils.errorPopup(error); }
});
} else {
list.stream().limit(5)
.forEach(favId -> favoriteService.getDetails(favId,
new Callback<Favorite>() {
public void onSuccess(Favorite details) {
UiUtils.submitOnUiThread(() -> uiList.show(details)); }
public void onError(Throwable error) {
UiUtils.errorPopup(error);}
}
));
}}
public void onError(Throwable error) { UiUtils.errorPopup(error); }
}
https://projectreactor.io/docs/core/release/reference/, Apache Software License 2.0
Listing Favs or Suggestions - Reactor
34
userService.getFavorites(userId)
.timeout(Duration.ofMillis(800))
.onErrorResume(cacheService.cachedFavoritesFor(userId))
.flatMap(favoriteService::getDetails)
.switchIfEmpty(suggestionService.getSuggestions())
.take(5)
.publishOn(UiUtils.uiThreadScheduler())
.subscribe(uiList::show, UiUtils::errorPopup);
});
https://projectreactor.io/docs/core/release/reference/, Apache Software License 2.0
Comb. Names & Stats – CompletableFuture
35
CompletableFuture<List<String>> ids = findIds();
CompletableFuture<List<String>> result = ids.thenComposeAsync(l -> {
Stream<CompletableFuture<String>> zip =
l.stream().map(i -> {
CompletableFuture<String> nameTask = findName(i);
CompletableFuture<Integer> statTask = findStat(i);
return nameTask.thenCombineAsync(statTask,
(name, stat) -> "Name " + name + " has stats " + stat); });
List<CompletableFuture<String>> combineList =
zip.collect(Collectors.toList());
CompletableFuture<String>[] combineArray =
combineList.toArray(new CompletableFuture[combineList.size()]);
CompletableFuture<Void> allDone =
CompletableFuture.allOf(combineArray);
return allDone.thenApply(v -> combineList.stream()
.map(CompletableFuture::join)
.collect(Collectors.toList()));
});
List<String> results = result.join();
https://projectreactor.io/docs/core/release/reference/, Apache Software License 2.0
Combined Names & Stats – Reactor
36
Flux<String> ids = findIds();
Flux<String> combinations =
ids.flatMap(id -> {
Mono<String> nameTask = findName(id);
Mono<Integer> statTask = findStat(id);
return nameTask.zipWith(statTask,
(name, stat) -> "Name " + name + " has stats " + stat);
});
Mono<List<String>> result = combinations.collectList();
List<String> results = result.block();
}
https://projectreactor.io/docs/core/release/reference/, Apache Software License 2.0
Imperative and Reactive
37
We live in a Connected Universe
... there is hypothesis that all
the things in the Universe are
intimately connected, and you
can not change a bit without
changing all.
Action – Reaction principle is
the essence of how Universe
behaves.
Imperative and Reactive
 Reactive Programming: using static or dynamic data
flows and propagation of change
Example: a := b + c
 Functional Programming: evaluation of mathematical
functions,
➢ Avoids changing-state and mutable data, declarative
programming
➢ Side effects free => much easier to understand and
predict the program behavior.
Example: books.stream().filter(book -> book.getYear() > 2010)
.forEach( System.out::println )
Functional Reactive (FRP)
39
According to Connal Elliot's (ground-breaking paper @
Conference on Functional Programming, 1997), FRP is:
(a) Denotative
(b) Temporally continuous
Reactive Programming
40
 Microsoft®
opens source polyglot project ReactiveX
(Reactive Extensions) [http://reactivex.io]:
Rx = Observables + LINQ + Schedulers :)
Java: RxJava, JavaScript: RxJS, C#: Rx.NET, Scala: RxScala,
Clojure: RxClojure, C++: RxCpp, Ruby: Rx.rb, Python: RxPY,
Groovy: RxGroovy, JRuby: RxJRuby, Kotlin: RxKotlin ...
 Reactive Streams Specification
[http://www.reactive-streams.org/] used by:
 (Spring) Project Reactor [http://projectreactor.io/]
 Actor Model – Akka (Java, Scala) [http://akka.io/]
Reactive Streams Spec.
41
 Reactive Streams – provides standard for
asynchronous stream processing with non-blocking
back pressure.
 Minimal set of interfaces, methods and protocols for
asynchronous data streams
 April 30, 2015: has been released version 1.0.0 of
Reactive Streams for the JVM (Java API,
Specification, TCK and implementation examples)
 Java 9+: java.util.concurrent.Flow
Reactive Streams Spec.
42
 Publisher – provider of potentially unbounded number
of sequenced elements, according to Subscriber(s)
demand.
Publisher.subscribe(Subscriber) => onSubscribe onNext*
(onError | onComplete)?
 Subscriber – calls Subscription.request(long) to
receive notifications
 Subscription – one-to-one Subscriber ↔ Publisher,
request data and cancel demand (allow cleanup).
 Processor = Subscriber + Publisher
FRP = Async Data Streams
43
 FRP is asynchronous data-flow programming using the
building blocks of functional programming (e.g. map,
reduce, filter) and explicitly modeling time
 Used for GUIs, robotics, and music. Example (RxJava):
Observable.from(
new String[]{"Reactive", "Extensions", "Java"})
.take(2).map(s -> s + " : on " + new Date())
.subscribe(s -> System.out.println(s));
Result:
Reactive : on Wed Jun 17 21:54:02 GMT+02:00 2015
Extensions : on Wed Jun 17 21:54:02 GMT+02:00 2015
Project Reactor
44
 Reactor project allows building high-performance (low
latency high throughput) non-blocking asynchronous
applications on JVM.
 Reactor is designed to be extraordinarily fast and can
sustain throughput rates on order of 10's of millions of
operations per second.
 Reactor has powerful API for declaring data
transformations and functional composition.
 Makes use of the concept of Mechanical Sympathy
built on top of Disruptor / RingBuffer.
Reactor Projects
45
https://github.com/reactor/reactor, Apache Software License 2.0
IPC – Netty, Kafka, Aeron
Reactor Flux
46
https://github.com/reactor/reactor-core, Apache Software License 2.0
Example: Flux.combineLatest()
47
https://projectreactor.io/core/docs/api/, Apache Software License 2.0
Source: RxJava 2 API documentation, http://reactivex.io/RxJava/2.x/javadoc/
Redux == Rx Scan Opearator
Hot and Cold Event Streams
49
 PULL-based (Cold Event Streams) – Cold streams (e.g.
RxJava Observable / Flowable or Reactor Flow / Mono)
are streams that run their sequence when and if they
are subscribed to. They present the sequence from the
start to each subscriber.
 PUSH-based (Hot Event Streams) – emit values
independent of individual subscriptions. They have their
own timeline and events occur whether someone is
listening or not. When subscription is made observer
receives current events as they happen.
Example: mouse events
Converting Cold to Hot Stream
50
Source: RxJava 2 API documentation, http://reactivex.io/RxJava/2.x/javadoc/
Hot Stream Example - Reactor
51
EmitterProcessor<String> emitter =
EmitterProcessor.create();
FluxSink<String> sink = emitter.sink();
emitter.publishOn(Schedulers.single())
.map(String::toUpperCase)
.filter(s -> s.startsWith("HELLO"))
.delayElements(Duration.of(1000, MILLIS))
.subscribe(System.out::println);
sink.next("Hello World!"); // emit - non blocking
sink.next("Goodbye World!");
sink.next("Hello Trayan!");
Thread.sleep(3000);
Reactor: Best Expalined in Code
52
Lets see some Reactive IoT demos @ GitHub:
https://github.com/iproduct/reactive-demos-iot
YouTube Video for the IoT demo:
https://www.youtube.com/watch?v=AB3AWAfcy9U
Druid Distributed Data Store (Java)
53
https://commons.wikimedia.org/w/index.php?curid=33899448 By Fangjin Yang - sent to me personally, GFDL
https://en.wikipedia.org/wiki/File:Flight_dynamics_with_text.png
Druid Distributed Data Store (Java)
54
https://commons.wikimedia.org/w/index.php?curid=33899448 By Fangjin Yang - sent to me personally, GFDLhttps://en.wikipedia.org/wiki/File:Centrale-
intertielle_missile_S3_Musee_du_Bourget_P1010652.JPG
55
Now much lighter and smaller -
data is available in realtime thanks
to reactive JAVA
Example: IPTPI - RPi + Ardunio Robot
56
 Raspberry Pi 2 (quad-core ARMv7
@ 900MHz) + Arduino Leonardo
cloneA-Star 32U4 Micro
 Optical encoders (custom), IR
optical array, 3D accelerometers,
gyros, and compass MinIMU-9 v2
 IPTPI is programmed in Java
using Pi4J, Reactor, RxJava, Akka
 More information about IPTPI:
http://robolearn.org/iptpi-robot/
IPTPI Hot Event Streams Example
57
Encoder
Readings
ArduinoData
Flux
Arduino
SerialData
Position
Flux
Robot
Positions
Command
Movement
Subscriber
RobotWSService
(using Reactor)
Angular 2 /
TypeScript
MovementCommands
Interested?-> Welcome to IPT Spring 5 &
Reactor Course
58
Thank’s for Your Attention!
59
Trayan Iliev
CEO of IPT – Intellectual Products
& Technologies
http://iproduct.org/
http://robolearn.org/
https://github.com/iproduct
https://twitter.com/trayaniliev
https://www.facebook.com/IPT.EACAD
https://plus.google.com/+IproductOrg

More Related Content

What's hot

Reactive Java Robotics IoT - jPrime 2016
Reactive Java Robotics IoT - jPrime 2016Reactive Java Robotics IoT - jPrime 2016
Reactive Java Robotics IoT - jPrime 2016Trayan Iliev
 
NGRX Apps in Depth
NGRX Apps in DepthNGRX Apps in Depth
NGRX Apps in DepthTrayan Iliev
 
Java & JavaScipt Reactive Robotics and IoT 2016 @ jProfessionals
Java & JavaScipt Reactive Robotics and IoT 2016 @ jProfessionalsJava & JavaScipt Reactive Robotics and IoT 2016 @ jProfessionals
Java & JavaScipt Reactive Robotics and IoT 2016 @ jProfessionalsTrayan Iliev
 
Reactive Card Magic: Understanding Spring WebFlux and Project Reactor
Reactive Card Magic: Understanding Spring WebFlux and Project ReactorReactive Card Magic: Understanding Spring WebFlux and Project Reactor
Reactive Card Magic: Understanding Spring WebFlux and Project ReactorVMware Tanzu
 
Reactive in Android and Beyond Rx
Reactive in Android and Beyond RxReactive in Android and Beyond Rx
Reactive in Android and Beyond RxFabio Tiriticco
 
7 New Tools Java Developers Should Know
7 New Tools Java Developers Should Know7 New Tools Java Developers Should Know
7 New Tools Java Developers Should KnowTakipi
 
Productionizing Machine Learning - Bigdata meetup 5-06-2019
Productionizing Machine Learning - Bigdata meetup 5-06-2019Productionizing Machine Learning - Bigdata meetup 5-06-2019
Productionizing Machine Learning - Bigdata meetup 5-06-2019Iulian Pintoiu
 
blueMarine photographic workflow with Java
blueMarine photographic workflow with JavablueMarine photographic workflow with Java
blueMarine photographic workflow with JavaFabrizio Giudici
 
DAWN and Scientific Workflows
DAWN and Scientific WorkflowsDAWN and Scientific Workflows
DAWN and Scientific WorkflowsMatthew Gerring
 
Zou Layered VO PDCAT2008 V0.5 Concise
Zou Layered VO PDCAT2008 V0.5 ConciseZou Layered VO PDCAT2008 V0.5 Concise
Zou Layered VO PDCAT2008 V0.5 Conciseyongqiangzou
 
Enterprise Software Architecture styles
Enterprise Software Architecture stylesEnterprise Software Architecture styles
Enterprise Software Architecture stylesAraf Karsh Hamid
 
fUML-Driven Performance Analysis through the MOSES Model Library
fUML-Driven Performance Analysisthrough the MOSES Model LibraryfUML-Driven Performance Analysisthrough the MOSES Model Library
fUML-Driven Performance Analysis through the MOSES Model LibraryLuca Berardinelli
 
OSIS19_Cloud : Des objets dans le cloud, et qui y restent -- L'expérience du ...
OSIS19_Cloud : Des objets dans le cloud, et qui y restent -- L'expérience du ...OSIS19_Cloud : Des objets dans le cloud, et qui y restent -- L'expérience du ...
OSIS19_Cloud : Des objets dans le cloud, et qui y restent -- L'expérience du ...Pôle Systematic Paris-Region
 
Defend against adversarial AI using Adversarial Robustness Toolbox
Defend against adversarial AI using Adversarial Robustness Toolbox Defend against adversarial AI using Adversarial Robustness Toolbox
Defend against adversarial AI using Adversarial Robustness Toolbox Animesh Singh
 
Let’s go reactive with JAVA
Let’s go reactive with JAVALet’s go reactive with JAVA
Let’s go reactive with JAVATech Triveni
 
On The Evolution of CAEX: A Language Engineering Perspective
On The Evolution of CAEX: A Language Engineering PerspectiveOn The Evolution of CAEX: A Language Engineering Perspective
On The Evolution of CAEX: A Language Engineering PerspectiveLuca Berardinelli
 
Contributing to JDK Mission Control
Contributing to JDK Mission ControlContributing to JDK Mission Control
Contributing to JDK Mission ControlMarcus Hirt
 
Abstractions and Directives for Adapting Wavefront Algorithms to Future Archi...
Abstractions and Directives for Adapting Wavefront Algorithms to Future Archi...Abstractions and Directives for Adapting Wavefront Algorithms to Future Archi...
Abstractions and Directives for Adapting Wavefront Algorithms to Future Archi...inside-BigData.com
 
GR8Conf 2009: Groovy in Fiance Case Study by Jonathan Felch
GR8Conf 2009: Groovy in Fiance Case Study by Jonathan FelchGR8Conf 2009: Groovy in Fiance Case Study by Jonathan Felch
GR8Conf 2009: Groovy in Fiance Case Study by Jonathan FelchGR8Conf
 
Integrating Performance Modeling in Industrial Automation through AutomationM...
Integrating Performance Modeling in Industrial Automation through AutomationM...Integrating Performance Modeling in Industrial Automation through AutomationM...
Integrating Performance Modeling in Industrial Automation through AutomationM...Luca Berardinelli
 

What's hot (20)

Reactive Java Robotics IoT - jPrime 2016
Reactive Java Robotics IoT - jPrime 2016Reactive Java Robotics IoT - jPrime 2016
Reactive Java Robotics IoT - jPrime 2016
 
NGRX Apps in Depth
NGRX Apps in DepthNGRX Apps in Depth
NGRX Apps in Depth
 
Java & JavaScipt Reactive Robotics and IoT 2016 @ jProfessionals
Java & JavaScipt Reactive Robotics and IoT 2016 @ jProfessionalsJava & JavaScipt Reactive Robotics and IoT 2016 @ jProfessionals
Java & JavaScipt Reactive Robotics and IoT 2016 @ jProfessionals
 
Reactive Card Magic: Understanding Spring WebFlux and Project Reactor
Reactive Card Magic: Understanding Spring WebFlux and Project ReactorReactive Card Magic: Understanding Spring WebFlux and Project Reactor
Reactive Card Magic: Understanding Spring WebFlux and Project Reactor
 
Reactive in Android and Beyond Rx
Reactive in Android and Beyond RxReactive in Android and Beyond Rx
Reactive in Android and Beyond Rx
 
7 New Tools Java Developers Should Know
7 New Tools Java Developers Should Know7 New Tools Java Developers Should Know
7 New Tools Java Developers Should Know
 
Productionizing Machine Learning - Bigdata meetup 5-06-2019
Productionizing Machine Learning - Bigdata meetup 5-06-2019Productionizing Machine Learning - Bigdata meetup 5-06-2019
Productionizing Machine Learning - Bigdata meetup 5-06-2019
 
blueMarine photographic workflow with Java
blueMarine photographic workflow with JavablueMarine photographic workflow with Java
blueMarine photographic workflow with Java
 
DAWN and Scientific Workflows
DAWN and Scientific WorkflowsDAWN and Scientific Workflows
DAWN and Scientific Workflows
 
Zou Layered VO PDCAT2008 V0.5 Concise
Zou Layered VO PDCAT2008 V0.5 ConciseZou Layered VO PDCAT2008 V0.5 Concise
Zou Layered VO PDCAT2008 V0.5 Concise
 
Enterprise Software Architecture styles
Enterprise Software Architecture stylesEnterprise Software Architecture styles
Enterprise Software Architecture styles
 
fUML-Driven Performance Analysis through the MOSES Model Library
fUML-Driven Performance Analysisthrough the MOSES Model LibraryfUML-Driven Performance Analysisthrough the MOSES Model Library
fUML-Driven Performance Analysis through the MOSES Model Library
 
OSIS19_Cloud : Des objets dans le cloud, et qui y restent -- L'expérience du ...
OSIS19_Cloud : Des objets dans le cloud, et qui y restent -- L'expérience du ...OSIS19_Cloud : Des objets dans le cloud, et qui y restent -- L'expérience du ...
OSIS19_Cloud : Des objets dans le cloud, et qui y restent -- L'expérience du ...
 
Defend against adversarial AI using Adversarial Robustness Toolbox
Defend against adversarial AI using Adversarial Robustness Toolbox Defend against adversarial AI using Adversarial Robustness Toolbox
Defend against adversarial AI using Adversarial Robustness Toolbox
 
Let’s go reactive with JAVA
Let’s go reactive with JAVALet’s go reactive with JAVA
Let’s go reactive with JAVA
 
On The Evolution of CAEX: A Language Engineering Perspective
On The Evolution of CAEX: A Language Engineering PerspectiveOn The Evolution of CAEX: A Language Engineering Perspective
On The Evolution of CAEX: A Language Engineering Perspective
 
Contributing to JDK Mission Control
Contributing to JDK Mission ControlContributing to JDK Mission Control
Contributing to JDK Mission Control
 
Abstractions and Directives for Adapting Wavefront Algorithms to Future Archi...
Abstractions and Directives for Adapting Wavefront Algorithms to Future Archi...Abstractions and Directives for Adapting Wavefront Algorithms to Future Archi...
Abstractions and Directives for Adapting Wavefront Algorithms to Future Archi...
 
GR8Conf 2009: Groovy in Fiance Case Study by Jonathan Felch
GR8Conf 2009: Groovy in Fiance Case Study by Jonathan FelchGR8Conf 2009: Groovy in Fiance Case Study by Jonathan Felch
GR8Conf 2009: Groovy in Fiance Case Study by Jonathan Felch
 
Integrating Performance Modeling in Industrial Automation through AutomationM...
Integrating Performance Modeling in Industrial Automation through AutomationM...Integrating Performance Modeling in Industrial Automation through AutomationM...
Integrating Performance Modeling in Industrial Automation through AutomationM...
 

Similar to IPT Reactive Java IoT Demo - BGOUG 2018

Build Real-Time Streaming ETL Pipelines With Akka Streams, Alpakka And Apache...
Build Real-Time Streaming ETL Pipelines With Akka Streams, Alpakka And Apache...Build Real-Time Streaming ETL Pipelines With Akka Streams, Alpakka And Apache...
Build Real-Time Streaming ETL Pipelines With Akka Streams, Alpakka And Apache...Lightbend
 
Reactive Java Robotics and IoT 2016
Reactive Java Robotics and IoT 2016Reactive Java Robotics and IoT 2016
Reactive Java Robotics and IoT 2016ilievt
 
Designing Event-Driven Applications with Apache NiFi, Apache Flink, Apache Sp...
Designing Event-Driven Applications with Apache NiFi, Apache Flink, Apache Sp...Designing Event-Driven Applications with Apache NiFi, Apache Flink, Apache Sp...
Designing Event-Driven Applications with Apache NiFi, Apache Flink, Apache Sp...Timothy Spann
 
Porting a Streaming Pipeline from Scala to Rust
Porting a Streaming Pipeline from Scala to RustPorting a Streaming Pipeline from Scala to Rust
Porting a Streaming Pipeline from Scala to RustEvan Chan
 
Functional reactive programming
Functional reactive programmingFunctional reactive programming
Functional reactive programmingAraf Karsh Hamid
 
Microservices Part 4: Functional Reactive Programming
Microservices Part 4: Functional Reactive ProgrammingMicroservices Part 4: Functional Reactive Programming
Microservices Part 4: Functional Reactive ProgrammingAraf Karsh Hamid
 
The magic behind your Lyft ride prices: A case study on machine learning and ...
The magic behind your Lyft ride prices: A case study on machine learning and ...The magic behind your Lyft ride prices: A case study on machine learning and ...
The magic behind your Lyft ride prices: A case study on machine learning and ...Karthik Murugesan
 
Pulsar summit asia 2021 apache pulsar with mqtt for edge computing
Pulsar summit asia 2021   apache pulsar with mqtt for edge computingPulsar summit asia 2021   apache pulsar with mqtt for edge computing
Pulsar summit asia 2021 apache pulsar with mqtt for edge computingTimothy Spann
 
Python Streaming Pipelines on Flink - Beam Meetup at Lyft 2019
Python Streaming Pipelines on Flink - Beam Meetup at Lyft 2019Python Streaming Pipelines on Flink - Beam Meetup at Lyft 2019
Python Streaming Pipelines on Flink - Beam Meetup at Lyft 2019Thomas Weise
 
Lambda Architecture Using SQL
Lambda Architecture Using SQLLambda Architecture Using SQL
Lambda Architecture Using SQLSATOSHI TAGOMORI
 
Reactive Programming on Android - RxAndroid - RxJava
Reactive Programming on Android - RxAndroid - RxJavaReactive Programming on Android - RxAndroid - RxJava
Reactive Programming on Android - RxAndroid - RxJavaAli Muzaffar
 
Strata Singapore: Gearpump Real time DAG-Processing with Akka at Scale
Strata Singapore: GearpumpReal time DAG-Processing with Akka at ScaleStrata Singapore: GearpumpReal time DAG-Processing with Akka at Scale
Strata Singapore: Gearpump Real time DAG-Processing with Akka at ScaleSean Zhong
 
Reactive robotics io_t_2017
Reactive robotics io_t_2017Reactive robotics io_t_2017
Reactive robotics io_t_2017Trayan Iliev
 
Unified Stream Processing at Scale with Apache Samza - BDS2017
Unified Stream Processing at Scale with Apache Samza - BDS2017Unified Stream Processing at Scale with Apache Samza - BDS2017
Unified Stream Processing at Scale with Apache Samza - BDS2017Jacob Maes
 
End to End Akka Streams / Reactive Streams - from Business to Socket
End to End Akka Streams / Reactive Streams - from Business to SocketEnd to End Akka Streams / Reactive Streams - from Business to Socket
End to End Akka Streams / Reactive Streams - from Business to SocketKonrad Malawski
 
Project Reactor Now and Tomorrow
Project Reactor Now and TomorrowProject Reactor Now and Tomorrow
Project Reactor Now and TomorrowVMware Tanzu
 
nuclio Overview October 2017
nuclio Overview October 2017nuclio Overview October 2017
nuclio Overview October 2017iguazio
 
Building Stateful Microservices With Akka
Building Stateful Microservices With AkkaBuilding Stateful Microservices With Akka
Building Stateful Microservices With AkkaYaroslav Tkachenko
 
Spark (Structured) Streaming vs. Kafka Streams - two stream processing platfo...
Spark (Structured) Streaming vs. Kafka Streams - two stream processing platfo...Spark (Structured) Streaming vs. Kafka Streams - two stream processing platfo...
Spark (Structured) Streaming vs. Kafka Streams - two stream processing platfo...Guido Schmutz
 

Similar to IPT Reactive Java IoT Demo - BGOUG 2018 (20)

Build Real-Time Streaming ETL Pipelines With Akka Streams, Alpakka And Apache...
Build Real-Time Streaming ETL Pipelines With Akka Streams, Alpakka And Apache...Build Real-Time Streaming ETL Pipelines With Akka Streams, Alpakka And Apache...
Build Real-Time Streaming ETL Pipelines With Akka Streams, Alpakka And Apache...
 
Reactive Java Robotics and IoT 2016
Reactive Java Robotics and IoT 2016Reactive Java Robotics and IoT 2016
Reactive Java Robotics and IoT 2016
 
Designing Event-Driven Applications with Apache NiFi, Apache Flink, Apache Sp...
Designing Event-Driven Applications with Apache NiFi, Apache Flink, Apache Sp...Designing Event-Driven Applications with Apache NiFi, Apache Flink, Apache Sp...
Designing Event-Driven Applications with Apache NiFi, Apache Flink, Apache Sp...
 
Porting a Streaming Pipeline from Scala to Rust
Porting a Streaming Pipeline from Scala to RustPorting a Streaming Pipeline from Scala to Rust
Porting a Streaming Pipeline from Scala to Rust
 
Functional reactive programming
Functional reactive programmingFunctional reactive programming
Functional reactive programming
 
Microservices Part 4: Functional Reactive Programming
Microservices Part 4: Functional Reactive ProgrammingMicroservices Part 4: Functional Reactive Programming
Microservices Part 4: Functional Reactive Programming
 
The magic behind your Lyft ride prices: A case study on machine learning and ...
The magic behind your Lyft ride prices: A case study on machine learning and ...The magic behind your Lyft ride prices: A case study on machine learning and ...
The magic behind your Lyft ride prices: A case study on machine learning and ...
 
Pulsar summit asia 2021 apache pulsar with mqtt for edge computing
Pulsar summit asia 2021   apache pulsar with mqtt for edge computingPulsar summit asia 2021   apache pulsar with mqtt for edge computing
Pulsar summit asia 2021 apache pulsar with mqtt for edge computing
 
Python Streaming Pipelines on Flink - Beam Meetup at Lyft 2019
Python Streaming Pipelines on Flink - Beam Meetup at Lyft 2019Python Streaming Pipelines on Flink - Beam Meetup at Lyft 2019
Python Streaming Pipelines on Flink - Beam Meetup at Lyft 2019
 
Lambda Architecture Using SQL
Lambda Architecture Using SQLLambda Architecture Using SQL
Lambda Architecture Using SQL
 
Reactive Programming on Android - RxAndroid - RxJava
Reactive Programming on Android - RxAndroid - RxJavaReactive Programming on Android - RxAndroid - RxJava
Reactive Programming on Android - RxAndroid - RxJava
 
Strata Singapore: Gearpump Real time DAG-Processing with Akka at Scale
Strata Singapore: GearpumpReal time DAG-Processing with Akka at ScaleStrata Singapore: GearpumpReal time DAG-Processing with Akka at Scale
Strata Singapore: Gearpump Real time DAG-Processing with Akka at Scale
 
Reactive robotics io_t_2017
Reactive robotics io_t_2017Reactive robotics io_t_2017
Reactive robotics io_t_2017
 
Unified Stream Processing at Scale with Apache Samza - BDS2017
Unified Stream Processing at Scale with Apache Samza - BDS2017Unified Stream Processing at Scale with Apache Samza - BDS2017
Unified Stream Processing at Scale with Apache Samza - BDS2017
 
Java one2013
Java one2013Java one2013
Java one2013
 
End to End Akka Streams / Reactive Streams - from Business to Socket
End to End Akka Streams / Reactive Streams - from Business to SocketEnd to End Akka Streams / Reactive Streams - from Business to Socket
End to End Akka Streams / Reactive Streams - from Business to Socket
 
Project Reactor Now and Tomorrow
Project Reactor Now and TomorrowProject Reactor Now and Tomorrow
Project Reactor Now and Tomorrow
 
nuclio Overview October 2017
nuclio Overview October 2017nuclio Overview October 2017
nuclio Overview October 2017
 
Building Stateful Microservices With Akka
Building Stateful Microservices With AkkaBuilding Stateful Microservices With Akka
Building Stateful Microservices With Akka
 
Spark (Structured) Streaming vs. Kafka Streams - two stream processing platfo...
Spark (Structured) Streaming vs. Kafka Streams - two stream processing platfo...Spark (Structured) Streaming vs. Kafka Streams - two stream processing platfo...
Spark (Structured) Streaming vs. Kafka Streams - two stream processing platfo...
 

More from Trayan Iliev

Rapid Web API development with Kotlin and Ktor
Rapid Web API development with Kotlin and KtorRapid Web API development with Kotlin and Ktor
Rapid Web API development with Kotlin and KtorTrayan Iliev
 
Learning Programming Using Robots - Sofia University Conference 2018
Learning Programming Using Robots - Sofia University Conference 2018 Learning Programming Using Robots - Sofia University Conference 2018
Learning Programming Using Robots - Sofia University Conference 2018 Trayan Iliev
 
Active Learning Using Connected Things - 2018 (in Bulgarian)
Active Learning Using Connected Things - 2018 (in Bulgarian)Active Learning Using Connected Things - 2018 (in Bulgarian)
Active Learning Using Connected Things - 2018 (in Bulgarian)Trayan Iliev
 
Fog Computing - DEV.BG 2018
Fog Computing - DEV.BG 2018Fog Computing - DEV.BG 2018
Fog Computing - DEV.BG 2018Trayan Iliev
 
React HOCs, Context and Observables
React HOCs, Context and ObservablesReact HOCs, Context and Observables
React HOCs, Context and ObservablesTrayan Iliev
 
Reactive Java Robotics & IoT with Spring Reactor
Reactive Java Robotics & IoT with Spring ReactorReactive Java Robotics & IoT with Spring Reactor
Reactive Java Robotics & IoT with Spring ReactorTrayan Iliev
 
Hackathon: “IPTPI and LeJaRo Meet The Real World”
Hackathon: “IPTPI and LeJaRo Meet The Real World”Hackathon: “IPTPI and LeJaRo Meet The Real World”
Hackathon: “IPTPI and LeJaRo Meet The Real World”Trayan Iliev
 
IPT angular2 typescript SPA 2016
IPT angular2 typescript SPA 2016IPT angular2 typescript SPA 2016
IPT angular2 typescript SPA 2016Trayan Iliev
 
New MVC 1.0 JavaEE 8 API
New MVC 1.0 JavaEE 8 APINew MVC 1.0 JavaEE 8 API
New MVC 1.0 JavaEE 8 APITrayan Iliev
 
IPT High Performance Reactive Programming with JAVA 8 and JavaScript
IPT High Performance Reactive Programming with JAVA 8 and JavaScriptIPT High Performance Reactive Programming with JAVA 8 and JavaScript
IPT High Performance Reactive Programming with JAVA 8 and JavaScriptTrayan Iliev
 
IPT Workshops on Java Robotics and IoT
IPT Workshops on Java Robotics and IoTIPT Workshops on Java Robotics and IoT
IPT Workshops on Java Robotics and IoTTrayan Iliev
 
IPT – Java Robotics and IoT
IPT – Java Robotics and IoTIPT – Java Robotics and IoT
IPT – Java Robotics and IoTTrayan Iliev
 
Novelties in Java EE 7: JAX-RS 2.0 + IPT REST HATEOAS Polling Demo @ BGOUG Co...
Novelties in Java EE 7: JAX-RS 2.0 + IPT REST HATEOAS Polling Demo @ BGOUG Co...Novelties in Java EE 7: JAX-RS 2.0 + IPT REST HATEOAS Polling Demo @ BGOUG Co...
Novelties in Java EE 7: JAX-RS 2.0 + IPT REST HATEOAS Polling Demo @ BGOUG Co...Trayan Iliev
 

More from Trayan Iliev (13)

Rapid Web API development with Kotlin and Ktor
Rapid Web API development with Kotlin and KtorRapid Web API development with Kotlin and Ktor
Rapid Web API development with Kotlin and Ktor
 
Learning Programming Using Robots - Sofia University Conference 2018
Learning Programming Using Robots - Sofia University Conference 2018 Learning Programming Using Robots - Sofia University Conference 2018
Learning Programming Using Robots - Sofia University Conference 2018
 
Active Learning Using Connected Things - 2018 (in Bulgarian)
Active Learning Using Connected Things - 2018 (in Bulgarian)Active Learning Using Connected Things - 2018 (in Bulgarian)
Active Learning Using Connected Things - 2018 (in Bulgarian)
 
Fog Computing - DEV.BG 2018
Fog Computing - DEV.BG 2018Fog Computing - DEV.BG 2018
Fog Computing - DEV.BG 2018
 
React HOCs, Context and Observables
React HOCs, Context and ObservablesReact HOCs, Context and Observables
React HOCs, Context and Observables
 
Reactive Java Robotics & IoT with Spring Reactor
Reactive Java Robotics & IoT with Spring ReactorReactive Java Robotics & IoT with Spring Reactor
Reactive Java Robotics & IoT with Spring Reactor
 
Hackathon: “IPTPI and LeJaRo Meet The Real World”
Hackathon: “IPTPI and LeJaRo Meet The Real World”Hackathon: “IPTPI and LeJaRo Meet The Real World”
Hackathon: “IPTPI and LeJaRo Meet The Real World”
 
IPT angular2 typescript SPA 2016
IPT angular2 typescript SPA 2016IPT angular2 typescript SPA 2016
IPT angular2 typescript SPA 2016
 
New MVC 1.0 JavaEE 8 API
New MVC 1.0 JavaEE 8 APINew MVC 1.0 JavaEE 8 API
New MVC 1.0 JavaEE 8 API
 
IPT High Performance Reactive Programming with JAVA 8 and JavaScript
IPT High Performance Reactive Programming with JAVA 8 and JavaScriptIPT High Performance Reactive Programming with JAVA 8 and JavaScript
IPT High Performance Reactive Programming with JAVA 8 and JavaScript
 
IPT Workshops on Java Robotics and IoT
IPT Workshops on Java Robotics and IoTIPT Workshops on Java Robotics and IoT
IPT Workshops on Java Robotics and IoT
 
IPT – Java Robotics and IoT
IPT – Java Robotics and IoTIPT – Java Robotics and IoT
IPT – Java Robotics and IoT
 
Novelties in Java EE 7: JAX-RS 2.0 + IPT REST HATEOAS Polling Demo @ BGOUG Co...
Novelties in Java EE 7: JAX-RS 2.0 + IPT REST HATEOAS Polling Demo @ BGOUG Co...Novelties in Java EE 7: JAX-RS 2.0 + IPT REST HATEOAS Polling Demo @ BGOUG Co...
Novelties in Java EE 7: JAX-RS 2.0 + IPT REST HATEOAS Polling Demo @ BGOUG Co...
 

Recently uploaded

The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptxThe Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptxRTS corp
 
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdfAndrey Devyatkin
 
VictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News UpdateVictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News UpdateVictoriaMetrics
 
What’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesWhat’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesVictoriaMetrics
 
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...OnePlan Solutions
 
Zer0con 2024 final share short version.pdf
Zer0con 2024 final share short version.pdfZer0con 2024 final share short version.pdf
Zer0con 2024 final share short version.pdfmaor17
 
Large Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLarge Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLionel Briand
 
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdfEnhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdfRTS corp
 
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxUI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxAndreas Kunz
 
Best Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh ITBest Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh ITmanoharjgpsolutions
 
Effectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorEffectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorTier1 app
 
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full RecordingOpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full RecordingShane Coughlan
 
Strategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero resultsStrategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero resultsJean Silva
 
Understanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM ArchitectureUnderstanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM Architecturerahul_net
 
Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Rob Geurden
 
SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?Alexandre Beguel
 
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4jGraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4jNeo4j
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringHironori Washizaki
 
Introduction to Firebase Workshop Slides
Introduction to Firebase Workshop SlidesIntroduction to Firebase Workshop Slides
Introduction to Firebase Workshop Slidesvaideheekore1
 
Keeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldKeeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldRoberto Pérez Alcolea
 

Recently uploaded (20)

The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptxThe Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
 
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
 
VictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News UpdateVictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News Update
 
What’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesWhat’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 Updates
 
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
 
Zer0con 2024 final share short version.pdf
Zer0con 2024 final share short version.pdfZer0con 2024 final share short version.pdf
Zer0con 2024 final share short version.pdf
 
Large Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLarge Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and Repair
 
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdfEnhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
 
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxUI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
 
Best Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh ITBest Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh IT
 
Effectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorEffectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryError
 
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full RecordingOpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
 
Strategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero resultsStrategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero results
 
Understanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM ArchitectureUnderstanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM Architecture
 
Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...
 
SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?
 
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4jGraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their Engineering
 
Introduction to Firebase Workshop Slides
Introduction to Firebase Workshop SlidesIntroduction to Firebase Workshop Slides
Introduction to Firebase Workshop Slides
 
Keeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldKeeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository world
 

IPT Reactive Java IoT Demo - BGOUG 2018

  • 1. November 16, 2018 BGOUG Autumn Conference Reactive Java for The Realtime Trayan Iliev tiliev@iproduct.org http://iproduct.org Copyright © 2003-2018 IPT - Intellectual Products & Technologies
  • 2. 2 Reactive Javafor The Realtime  Java data streaming for the (soft) realtime applicatins  Async programming alternatives  Introduction to FRP, Reactive Streams spec  RxJava Project Reactor  REST services with JAX-RS and Reactor  End-to-end non-blocking reactive SOA with Netty  Realtime event streaming to JS clients using SSE  IoT event streaming demo
  • 3. 3 Reactive Javafor The Realtime  Java data streaming for the (soft) realtime applicatins  Async programming alternatives  Introduction to FRP, Reactive Streams spec  RxJava Project Reactor  REST services with JAX-RS and Reactor  End-to-end non-blocking reactive SOA with Netty  Realtime event streaming to JS clients using SSE  IoT event streaming demo Best Explained in Code
  • 4. About me 4 Trayan Iliev – CEO of IPT – Intellectual Products & Technologies (http://iproduct.org/) – Oracle® certified programmer 15+ Y – end-to-end reactive fullstack apps with Java, ES6/7, TypeScript, Angular, React and Vue.js – 12+ years IT trainer – Voxxed Days, jPrime, jProfessionals, BGOUG, BGJUG, DEV.BG speaker – Organizer RoboLearn hackathons and IoT enthusiast (http://robolearn.org)
  • 5. 5 Since 2003: IT Education Evolved. Courses:  Java SE/Web/EE, JPA / Hibernate, Spring 5  Reactive event stream processing with Reactor / RxJava / RxJS  Node.js + Express + React + Redux + GraphQL  Angular + TypeScript + GraphQL  SOA & REST HATEOAS  DDD & Reactive Microservices IPT - Intellectual Products & Technologies http://www.iproduct.org
  • 6. Where to Find the Demo Code? 6 Reactive IoT demos available @ GitHub: https://github.com/iproduct/reactive-demos-iot YouTube Video for the IoT demo: https://www.youtube.com/watch?v=AB3AWAfcy9U
  • 7. Data / Event / Message Streams 7 “Conceptually, a stream is a (potentially never-ending) flow of data records, and a transformation is an operation that takes one or more streams as input, and produces one or more output streams as a result.” Apache Flink: Dataflow Programming Model
  • 8. Data Stream Programming 8 The idea of abstracting logic from execution is hardly new -- it was the dream of SOA. And the recent emergence of microservices and containers shows that the dream still lives on. For developers, the question is whether they want to learn yet one more layer of abstraction to their coding. On one hand, there's the elusive promise of a common API to streaming engines that in theory should let you mix and match, or swap in and swap out. Tony Baer (Ovum) @ ZDNet - Apache Beam and Spark: New coopetition for squashing the Lambda Architecture?
  • 9. Realtime Event Processing 9 Distributed realtime event processing becomes a hot topic:  IoT,  Service/process monitoring,  Realtime analytics, fraud detection  Click stream analytics  Stock-trading analysis  Supply chain and transportation alerts  ...
  • 10. Lambda Architecture - I 10 https://commons.wikimedia.org/w/index.php?curid=34963986, By Textractor - Own work, CC BY-SA 4
  • 11. Lambda Architecture - II 11 https://commons.wikimedia.org/w/index.php?curid=34963987, By Textractor - Own work, CC BY-SA 4
  • 12. Lambda Architecture - III 12  Data-processing architecture designed to handle massive quantities of data by using both batch- and stream-processing methods  Balances latency, throughput, fault-tolerance, big data, real-time analytics, mitigates the latencies of map-reduce  Data model with an append-only, immutable data source that serves as a system of record  Ingesting and processing timestamped events that are appended to existing events. State is determined from the natural time-based ordering of the data.
  • 13. Lambda Architecture: Projects - I 13  Apache Spark is an open-source cluster-computing framework. Spark Streaming, Spark Mllib  Apache Storm is a distributed stream processing – streams DAG  Apache Apex™ unified stream and batch processing engine.
  • 14. Lambda Architecture: Projects - II  Apache Flink - open source stream processing framework – Java, Scala  Apache Kafka - open-source stream processing (Kafka Streams), real- time, low-latency, high-throughput, massively scalable pub/sub  Apache Beam – unified batch and streaming, portable, extensible
  • 16. Synchronous vs. Asynchronous IO 16 DB Synchronous A A B B DB Asynchronous A B C D A B C D
  • 17. Example: Internet of Things (IoT) 17 CC BY 2.0, Source: https://www.flickr.com/photos/wilgengebroed/8249565455/ Radar, GPS, lidar for navigation and obstacle avoidance ( 2007 DARPA Urban Challenge )
  • 18. IoT Services Architecture 18 Devices: Hardware + Embedded Software + Firmware UART/ I2C/ 2G/ 3G/ LTE/ ZigBee/ 6LowPan/ BLE Aggregation/ Bus: ESB, Message Broker Device Gateway: Local Coordination and Event Aggregation M2M: HTTP(/2) / WS / MQTT / CoAP Management: TR-069 / OMA-DM / OMA LWM2M HTTP, AMQP Cloud (Micro)Service Mng. Docker, Kubernetes/ Apache Brooklyn Web/ Mobile Portal PaaSDashboard PaaS API: Event Processing Services, Analytics
  • 19. 19  Performance is about 2 things (Martin Thompson – http://www.infoq.com/articles/low-latency-vp ): – Throughput – units per second, and – Latency – response time  Real-time – time constraint from input to response regardless of system load.  Hard real-time system if this constraint is not honored then a total system failure can occur.  Soft real-time system – low latency response with little deviation in response time  100 nano-seconds to 100 milli-seconds. [Peter Lawrey] What's High Performance?
  • 20. 20  Callbacks – asynchronous methods do not have a return value but take an extra callback parameter (a lambda or anonymous class) that gets called when the result is available. Ex.: Swing’s EventListener  Futures, Promises – asynchronous methods return a (Completable)Future<T> immediately. The value is not immediately available, and the object can be polled Ex.: Callable<T> task  Reactive Streams (functional, non-blocking) – Observable (RxJava), Flowable (RxJava2), Flux & Mono (Project Reactor):  Composability and readability  Data as a flow manipulated with a rich vocabulary of operators  Lazy evaluation – nothing happens until you subscribe ()  Backpressure – consumer can signal to producer that the rate is high  High level but high value abstraction that is concurrency-agnostic How to Do Async Programming? Source: https://projectreactor.io/docs/core/release/reference
  • 21. Futures in Java 8 - I 21  Future (implemented by FutureTask) – represents the result of an cancelable asynchronous computation. Methods are provided to check if the computation is complete, to wait for its completion, and to retrieve the result of the computation (blocking till its ready).  RunnableFuture – a Future that is Runnable. Successful execution of the run method causes Future completion, and allows access to its results.  ScheduledFuture – delayed cancelable action that returns result. Usually a scheduled future is the result of scheduling a task with a ScheduledExecutorService
  • 22. Future Use Example 22 Future<String> future = executor.submit( new Callable<String>() { public String call() { return searchService.findByTags(tags); } } ); DoSomethingOther(); try { showResult(future.get()); // use future result } catch (ExecutionException ex) { cleanup(); }
  • 23. Futures in Java 8 - II 23  CompletableFuture – a Future that may be explicitly completed (by setting its value and status), and may be used as a CompletionStage, supporting dependent functions and actions that trigger upon its completion.  CompletionStage – a stage of possibly asynchronous computation, that is triggered by completion of previous stage or stages (CompletionStages form Direct Acyclic Graph – DAG). A stage performs an action or computes value and completes upon termination of its computation, which in turn triggers next dependent stages. Computation may be Function (apply), Consumer (accept), or Runnable (run).
  • 24. CompletableFuture Example - I 24 private CompletableFuture<String> longCompletableFutureTask(int i, Executor executor) { return CompletableFuture.supplyAsync(() -> { try { Thread.sleep(1000); // long computation :) } catch (InterruptedException e) { e.printStackTrace(); } return i + "-" + "test"; }, executor); }
  • 25. CompletableFuture Example - II 25 ExecutorService executor = ForkJoinPool.commonPool(); //ExecutorService executor = Executors.newCachedThreadPool(); public void testlCompletableFutureSequence() { List<CompletableFuture<String>> futuresList = IntStream.range(0, 20).boxed() .map(i -> longCompletableFutureTask(i, executor) .exceptionally(t -> t.getMessage())) .collect(Collectors.toList()); CompletableFuture<List<String>> results = CompletableFuture.allOf( futuresList.toArray(new CompletableFuture[0])) .thenApply(v -> futuresList.stream() .map(CompletableFuture::join) .collect(Collectors.toList()) );
  • 26. CompletableFuture Example - III 26 try { System.out.println(results.get(10, TimeUnit.SECONDS)); } catch (ExecutionException | TimeoutException | InterruptedException e) { e.printStackTrace(); } executor.shutdown(); } // OR just: System.out.println(results.join()); executor.shutdown(); Which is better?
  • 27. CompletionStage 27  Computation may be Function (apply), Consumer (accept), or Runnable (run) – e.g.: completionStage.thenApply( x -> x * x ) .thenAccept(System.out::print ) .thenRun( System.out::println )  Stage computation can be triggered by completion of 1 (then), 2 (combine), or either 1 of 2 (either)  Functional composition can be applied to stages themselves instead to their results using compose  handle & whenComplete – support unconditional computation – both normal or exceptional triggering
  • 28. CompletionStages Composition 28 public void testlCompletableFutureComposition() throws InterruptedException, ExecutionException { Double priceInEuro = CompletableFuture.supplyAsync(() -> getStockPrice("GOOGL")) .thenCombine(CompletableFuture.supplyAsync(() -> getExchangeRate(USD, EUR)), this::convertPrice) .exceptionally(throwable -> { System.out.println("Error: " + throwable.getMessage()); return -1d; }).get(); System.out.println("GOOGL stock price in Euro: " + priceInEuro ); }
  • 29. More Demos ... 29 CompletableFuture, Flow & RxJava2 @ GitHub: https://github.com/iproduct/reactive-demos-java-9  completable-future-demo – composition, delayed, ...  flow-demo – custom Flow implementations using CFs  rxjava2-demo – RxJava2 intro to reactive composition  completable-future-jaxrs-cdi-cxf – async observers, ...  completable-future-jaxrs-cdi-jersey  completable-future-jaxrs-cdi-jersey-client
  • 30. Ex.1: Async CDI Events with CF 30 @Inject @CpuProfiling private Event<CpuLoad> event; ... IntervalPublisher.getDefaultIntervalPublisher( 500, TimeUnit.MILLISECONDS) // Custom CF Flow Publisher .subscribe(new Subscriber<Integer>() { @Override public void onComplete() {} @Override public void onError(Throwable t) {} @Override public void onNext(Integer i) { event.fireAsync(new CpuLoad( System.currentTimeMillis(), getJavaCPULoad(), areProcessesChanged())) .thenAccept(event -> { logger.info("CPU load event fired: " + event); }); } //firing CDI async event returns CF @Override public void onSubscribe(Subscription subscription) {subscription.request(Long.MAX_VALUE);} });
  • 31. Ex.2: Reactive JAX-RS Client - CF 31 CompletionStage<List<ProcessInfo>> processesStage = processes.request().rx() .get(new GenericType<List<ProcessInfo>>() {}) .exceptionally(throwable -> { logger.error("Error: " + throwable.getMessage()); return Collections.emptyList(); }); CompletionStage<Void> printProcessesStage = processesStage.thenApply(proc -> { System.out.println("Active JAVA Processes: " + proc); return null; });
  • 32. Ex.2: Reactive JAX-RS Client - CF 32 (- continues -) printProcessesStage.thenRun( () -> { try (SseEventSource source = SseEventSource.target(stats).build()) { source.register(System.out::println); source.open(); Thread.sleep(20000); // Consume events for 20 sec } catch (InterruptedException e) { logger.info("SSE consumer interrupted: " + e); } }) .thenRun(() -> {System.exit(0);});
  • 33. Listing Favs or Suggestions - Callbacks 33 userService.getFavorites(userId, new Callback<List<String>>() { public void onSuccess(List<String> list) { if (list.isEmpty()) { suggestionService.getSuggestions(new Callback<List<Favorite>>() { public void onSuccess(List<Favorite> list) { UiUtils.submitOnUiThread(() -> { list.stream().limit(5).forEach(uiList::show);}); } public void onError(Throwable error) { UiUtils.errorPopup(error); } }); } else { list.stream().limit(5) .forEach(favId -> favoriteService.getDetails(favId, new Callback<Favorite>() { public void onSuccess(Favorite details) { UiUtils.submitOnUiThread(() -> uiList.show(details)); } public void onError(Throwable error) { UiUtils.errorPopup(error);} } )); }} public void onError(Throwable error) { UiUtils.errorPopup(error); } } https://projectreactor.io/docs/core/release/reference/, Apache Software License 2.0
  • 34. Listing Favs or Suggestions - Reactor 34 userService.getFavorites(userId) .timeout(Duration.ofMillis(800)) .onErrorResume(cacheService.cachedFavoritesFor(userId)) .flatMap(favoriteService::getDetails) .switchIfEmpty(suggestionService.getSuggestions()) .take(5) .publishOn(UiUtils.uiThreadScheduler()) .subscribe(uiList::show, UiUtils::errorPopup); }); https://projectreactor.io/docs/core/release/reference/, Apache Software License 2.0
  • 35. Comb. Names & Stats – CompletableFuture 35 CompletableFuture<List<String>> ids = findIds(); CompletableFuture<List<String>> result = ids.thenComposeAsync(l -> { Stream<CompletableFuture<String>> zip = l.stream().map(i -> { CompletableFuture<String> nameTask = findName(i); CompletableFuture<Integer> statTask = findStat(i); return nameTask.thenCombineAsync(statTask, (name, stat) -> "Name " + name + " has stats " + stat); }); List<CompletableFuture<String>> combineList = zip.collect(Collectors.toList()); CompletableFuture<String>[] combineArray = combineList.toArray(new CompletableFuture[combineList.size()]); CompletableFuture<Void> allDone = CompletableFuture.allOf(combineArray); return allDone.thenApply(v -> combineList.stream() .map(CompletableFuture::join) .collect(Collectors.toList())); }); List<String> results = result.join(); https://projectreactor.io/docs/core/release/reference/, Apache Software License 2.0
  • 36. Combined Names & Stats – Reactor 36 Flux<String> ids = findIds(); Flux<String> combinations = ids.flatMap(id -> { Mono<String> nameTask = findName(id); Mono<Integer> statTask = findStat(id); return nameTask.zipWith(statTask, (name, stat) -> "Name " + name + " has stats " + stat); }); Mono<List<String>> result = combinations.collectList(); List<String> results = result.block(); } https://projectreactor.io/docs/core/release/reference/, Apache Software License 2.0
  • 37. Imperative and Reactive 37 We live in a Connected Universe ... there is hypothesis that all the things in the Universe are intimately connected, and you can not change a bit without changing all. Action – Reaction principle is the essence of how Universe behaves.
  • 38. Imperative and Reactive  Reactive Programming: using static or dynamic data flows and propagation of change Example: a := b + c  Functional Programming: evaluation of mathematical functions, ➢ Avoids changing-state and mutable data, declarative programming ➢ Side effects free => much easier to understand and predict the program behavior. Example: books.stream().filter(book -> book.getYear() > 2010) .forEach( System.out::println )
  • 39. Functional Reactive (FRP) 39 According to Connal Elliot's (ground-breaking paper @ Conference on Functional Programming, 1997), FRP is: (a) Denotative (b) Temporally continuous
  • 40. Reactive Programming 40  Microsoft® opens source polyglot project ReactiveX (Reactive Extensions) [http://reactivex.io]: Rx = Observables + LINQ + Schedulers :) Java: RxJava, JavaScript: RxJS, C#: Rx.NET, Scala: RxScala, Clojure: RxClojure, C++: RxCpp, Ruby: Rx.rb, Python: RxPY, Groovy: RxGroovy, JRuby: RxJRuby, Kotlin: RxKotlin ...  Reactive Streams Specification [http://www.reactive-streams.org/] used by:  (Spring) Project Reactor [http://projectreactor.io/]  Actor Model – Akka (Java, Scala) [http://akka.io/]
  • 41. Reactive Streams Spec. 41  Reactive Streams – provides standard for asynchronous stream processing with non-blocking back pressure.  Minimal set of interfaces, methods and protocols for asynchronous data streams  April 30, 2015: has been released version 1.0.0 of Reactive Streams for the JVM (Java API, Specification, TCK and implementation examples)  Java 9+: java.util.concurrent.Flow
  • 42. Reactive Streams Spec. 42  Publisher – provider of potentially unbounded number of sequenced elements, according to Subscriber(s) demand. Publisher.subscribe(Subscriber) => onSubscribe onNext* (onError | onComplete)?  Subscriber – calls Subscription.request(long) to receive notifications  Subscription – one-to-one Subscriber ↔ Publisher, request data and cancel demand (allow cleanup).  Processor = Subscriber + Publisher
  • 43. FRP = Async Data Streams 43  FRP is asynchronous data-flow programming using the building blocks of functional programming (e.g. map, reduce, filter) and explicitly modeling time  Used for GUIs, robotics, and music. Example (RxJava): Observable.from( new String[]{"Reactive", "Extensions", "Java"}) .take(2).map(s -> s + " : on " + new Date()) .subscribe(s -> System.out.println(s)); Result: Reactive : on Wed Jun 17 21:54:02 GMT+02:00 2015 Extensions : on Wed Jun 17 21:54:02 GMT+02:00 2015
  • 44. Project Reactor 44  Reactor project allows building high-performance (low latency high throughput) non-blocking asynchronous applications on JVM.  Reactor is designed to be extraordinarily fast and can sustain throughput rates on order of 10's of millions of operations per second.  Reactor has powerful API for declaring data transformations and functional composition.  Makes use of the concept of Mechanical Sympathy built on top of Disruptor / RingBuffer.
  • 45. Reactor Projects 45 https://github.com/reactor/reactor, Apache Software License 2.0 IPC – Netty, Kafka, Aeron
  • 48. Source: RxJava 2 API documentation, http://reactivex.io/RxJava/2.x/javadoc/ Redux == Rx Scan Opearator
  • 49. Hot and Cold Event Streams 49  PULL-based (Cold Event Streams) – Cold streams (e.g. RxJava Observable / Flowable or Reactor Flow / Mono) are streams that run their sequence when and if they are subscribed to. They present the sequence from the start to each subscriber.  PUSH-based (Hot Event Streams) – emit values independent of individual subscriptions. They have their own timeline and events occur whether someone is listening or not. When subscription is made observer receives current events as they happen. Example: mouse events
  • 50. Converting Cold to Hot Stream 50 Source: RxJava 2 API documentation, http://reactivex.io/RxJava/2.x/javadoc/
  • 51. Hot Stream Example - Reactor 51 EmitterProcessor<String> emitter = EmitterProcessor.create(); FluxSink<String> sink = emitter.sink(); emitter.publishOn(Schedulers.single()) .map(String::toUpperCase) .filter(s -> s.startsWith("HELLO")) .delayElements(Duration.of(1000, MILLIS)) .subscribe(System.out::println); sink.next("Hello World!"); // emit - non blocking sink.next("Goodbye World!"); sink.next("Hello Trayan!"); Thread.sleep(3000);
  • 52. Reactor: Best Expalined in Code 52 Lets see some Reactive IoT demos @ GitHub: https://github.com/iproduct/reactive-demos-iot YouTube Video for the IoT demo: https://www.youtube.com/watch?v=AB3AWAfcy9U
  • 53. Druid Distributed Data Store (Java) 53 https://commons.wikimedia.org/w/index.php?curid=33899448 By Fangjin Yang - sent to me personally, GFDL https://en.wikipedia.org/wiki/File:Flight_dynamics_with_text.png
  • 54. Druid Distributed Data Store (Java) 54 https://commons.wikimedia.org/w/index.php?curid=33899448 By Fangjin Yang - sent to me personally, GFDLhttps://en.wikipedia.org/wiki/File:Centrale- intertielle_missile_S3_Musee_du_Bourget_P1010652.JPG
  • 55. 55 Now much lighter and smaller - data is available in realtime thanks to reactive JAVA
  • 56. Example: IPTPI - RPi + Ardunio Robot 56  Raspberry Pi 2 (quad-core ARMv7 @ 900MHz) + Arduino Leonardo cloneA-Star 32U4 Micro  Optical encoders (custom), IR optical array, 3D accelerometers, gyros, and compass MinIMU-9 v2  IPTPI is programmed in Java using Pi4J, Reactor, RxJava, Akka  More information about IPTPI: http://robolearn.org/iptpi-robot/
  • 57. IPTPI Hot Event Streams Example 57 Encoder Readings ArduinoData Flux Arduino SerialData Position Flux Robot Positions Command Movement Subscriber RobotWSService (using Reactor) Angular 2 / TypeScript MovementCommands
  • 58. Interested?-> Welcome to IPT Spring 5 & Reactor Course 58
  • 59. Thank’s for Your Attention! 59 Trayan Iliev CEO of IPT – Intellectual Products & Technologies http://iproduct.org/ http://robolearn.org/ https://github.com/iproduct https://twitter.com/trayaniliev https://www.facebook.com/IPT.EACAD https://plus.google.com/+IproductOrg