SlideShare a Scribd company logo
Konrad `ktoso` Malawski & Johan AndrƩn
pic: 1:1 scale Gundam model @ Odaiba, Tokyo
streams / Reactive Streams
End to end
– from Business to Socket
Konrad `ktoso` Malawski
Akka Team,
Reactive Streams TCK,
Persistence, HTTP
Konrad `@ktosopl` Malawski
work: akka.io lightbend.com
personal blog: http://kto.so
communities: geecon.org Java.pl / KrakowScala.pl sckrk.com GDGKrakow.pl lambdakrk.pl
Special thanks to
Johan AndrƩn
for helping prepare the examples.
Akka Team
Stockholm Scala User Group
Nice to meet you!
Who are you?
Make building powerful concurrent &
distributed applications simple.
Akka is a toolkit and runtime
for building highly concurrent,
distributed, and resilient
message-driven applications
on the JVM
Actors – simple & high performance concurrency
Cluster / Remoting – location transparency, resilience
Cluster Sharding – and more prepackaged patterns
Streams – back-pressured stream processing
Persistence – Event Sourcing
HTTP – complete, fully async and reactive HTTP Server
Official Kafka, Cassandra, DynamoDB integrations, tons
more in the community
Complete Java & Scala APIs for all features (since day 1)
Typed coming soon…
End to End Akka Streams / Reactive Streams - from Business to Socket
ā€œStreamā€
ā€œStreamā€
What does it mean?!
Suddenly everyone jumped on the word ā€œStreamā€.
Akka Streams / Reactive Streams started end-of-2013.
ā€œStreamsā€
* when put in ā€œā€ the word does not appear in project name, but is present in examples / style of APIs / wording.
Suddenly everyone jumped on the word ā€œStreamā€.
Akka Streams / Reactive Streams started end-of-2013.
ā€œStreamsā€
Akka Streams
Reactive Streams
RxJava ā€œstreamsā€*
Spark Streaming
Apache Storm ā€œstreamsā€*
Java Steams (JDK8)
Reactor ā€œstreamsā€*
Kafka Streams
ztellman / Manifold (Clojure)
* when put in ā€œā€ the word does not appear in project name, but is present in examples / style of APIs / wording.
Apache GearPump ā€œstreamsā€
Apache [I] Streams (!)
Apache [I] Beam ā€œstreamsā€
Apache [I] Quarks ā€œstreamsā€
Apache [I] Airflow ā€œstreamsā€ (dead?)
Apache [I] Samza
Scala Stream
Scalaz Streams, now known as FS2
Swave.io
Java InputStream / OutputStream / … :-)
The origins.
Reactive Streams
What is back-pressure?
?
What is back-pressure?
No no no…!
Not THAT Back-pressure!
No no no…!
Not THAT Back-pressure!
What is back-pressure?
Why back-pressure?
Why back-pressure?
Why back-pressure?
So you’ve built your app and it’s awesome.
Why back-pressure?
Let’s not smash it horribly under load.
Reactive Streams - story: 2013’s impls
~2013:
Reactive Programming
becoming widely adopted on JVM.
- Play introduced ā€œIterateesā€
- Akka (2009) had Akka-IO (TCP etc.)
- Ben starts work on RxJava
http://blogs.msdn.com/b/rxteam/archive/2009/11/17/announcing-reactive-extensions-rx-for-net-silverlight.aspx
http://infoscience.epfl.ch/record/176887/files/DeprecatingObservers2012.pdf - Ingo Maier, Martin Odersky
https://github.com/ReactiveX/RxJava/graphs/contributors
https://github.com/reactor/reactor/graphs/contributors
https://medium.com/@viktorklang/reactive-streams-1-0-0-interview-faaca2c00bec#.69st3rndy
Teams discuss need for back-pressure
in simple user API.
Play’s Iteratee / Akka’s NACK in IO.
}
Reactive Streams - story: 2013’s impls
Play Iteratees – pull back-pressure, difficult API
http://blogs.msdn.com/b/rxteam/archive/2009/11/17/announcing-reactive-extensions-rx-for-net-silverlight.aspx
http://infoscience.epfl.ch/record/176887/files/DeprecatingObservers2012.pdf - Ingo Maier, Martin Odersky
https://github.com/ReactiveX/RxJava/graphs/contributors
https://github.com/reactor/reactor/graphs/contributors
https://medium.com/@viktorklang/reactive-streams-1-0-0-interview-faaca2c00bec#.69st3rndy
Akka-IO – NACK back-pressure; low-level IO (Bytes); messaging API
RxJava – no back-pressure, nice API
Reactive Streams - expert group founded
October 2013
Roland Kuhn (Akka) and Erik Meijer (Rx .NET) meet in Lausanne,
while recording ā€œPrinciples of Reactive Programmingā€ Coursera Course.
Viktor Klang (Akka), Erik Meijer, Ben Christensen (RxJava)
and Marius Eriksen (Twitter) meet at Twitter HQ.
The term ā€œreactive non-blocking asynchronous back-pressureā€ gets coined.
Afterwards more organisations are invited to join the effort, including Pivotal, RedHat etc.
Reactive Streams - expert group founded
October 2013
Roland Kuhn (Akka) and Erik Meijer (Rx .NET) meet in Lausanne,
while recording ā€œPrinciples of Reactive Programmingā€ Coursera Course.
Viktor Klang (Akka), Erik Meijer, Ben Christensen (RxJava)
and Marius Eriksen (Twitter) meet at Twitter HQ.
The term ā€œreactive non-blocking asynchronous back-pressureā€ gets coined.Goals:
- asynchronous
- never block (waste)
- safe (back-threads pressured)
- purely local abstraction
- allow synchronous impls.
Reactive Streams - expert group founded
October 2013
Roland Kuhn (Akka) and Erik Meijer (Rx .NET) meet in Lausanne,
while recording ā€œPrinciples of Reactive Programmingā€ Coursera Course.
Viktor Klang (Akka), Erik Meijer, Ben Christensen (RxJava)
and Marius Eriksen (Twitter) meet at Twitter HQ.
The term ā€œreactive non-blocking asynchronous back-pressureā€ gets coined.
December 2013
Stephane Maldini & Jon Brisbin (Pivotal Reactor) contacted by Viktor.
Reactive Streams - expert group founded
October 2013
Roland Kuhn (Akka) and Erik Meijer (Rx .NET) meet in Lausanne,
while recording ā€œPrinciples of Reactive Programmingā€ Coursera Course.
Viktor Klang (Akka), Erik Meijer, Ben Christensen (RxJava)
and Marius Eriksen (Twitter) meet at Twitter HQ.
The term ā€œreactive non-blocking asynchronous back-pressureā€ gets coined.
December 2013
Stephane Maldini & Jon Brisbin (Pivotal Reactor) contacted by Viktor.
Soon after, the ā€œReactive Streamsā€ expert group is formed.
Also joining the efforts: Doug Lea (Oracle), EndreVarga (Akka), Johannes Rudolph & 

Mathias Doenitz (Spray), and many others, including myself join the effort soon after.
October 2013
Roland Kuhn (Akka) and Erik Meijer (Rx .NET) meet in Lausanne,
while recording ā€œPrinciples of Reactive Programmingā€ Coursera Course.
Viktor Klang (Akka), Erik Meijer, Ben Christensen (RxJava)
and Marius Eriksen (Twitter) meet at Twitter HQ.
The term ā€œreactive non-blocking asynchronous back-pressureā€ gets coined.
December 2013
Stephane Maldini & Jon Brisbin (Pivotal Reactor) contacted by Viktor.
Soon after, the ā€œReactive Streamsā€ expert group is formed.
Also joining the efforts: Doug Lea (Oracle), EndreVarga (Akka), Johannes Rudolph & 

Mathias Doenitz (Spray), and many others, including myself join the effort soon after.
Reactive Streams - expert group founded
I ended up implementing much of the TCK.
Please use it, let me know if it needs improvements :-)
Reactive Streams - story: 2013’s impls
2014–2015:
Reactive Streams Spec & TCK
development, and implementations.
1.0 released on April 28th 2015,
with 5+ accompanying implementations.
2015
Proposed to be included with JDK9 by Doug Lea
via JEP-266 ā€œMore Concurrency Updatesā€
http://hg.openjdk.java.net/jdk9/jdk9/jdk/file/6e50b992bef4/src/java.base/share/classes/java/util/concurrent/Flow.java
2014–2015:
Reactive Streams Spec & TCK
development, and implementations.
1.0 released on April 28th 2015,
with 5+ accompanying implementations.
2015
Proposed to be included with JDK9 by Doug Lea
via JEP-266 ā€œMore Concurrency Updatesā€
http://hg.openjdk.java.net/jdk9/jdk9/jdk/file/6e50b992bef4/src/java.base/share/classes/java/util/concurrent/Flow.java
Reactive Streams - story: 2013’s impls
But what does it do!?
Reactive Streams
Publisher[T] Subscriber[T]
Back-pressure explained
Fast Publisher Slow Subscriber
Push model
Subscriber usually has some kind of buffer.
Push model
Push model
Push model
What if the buffer overflows?
Push model
Use bounded buffer,
drop messages + require re-sending
Push model
Kernel does this!
Routers do this!
(TCP)
Use bounded buffer,
drop messages + require re-sending
Push model
Increase buffer size…
Well, while you have memory available!
Push model
Push model
Reactive Streams explained
Reactive Streams
explained in 1 slide
Fast Publisher will send at-most 3 elements.
This is pull-based-backpressure.
Reactive Streams: ā€œdynamic push/pullā€
JEP-266 – soon…!
public final class Flow {
private Flow() {} // uninstantiable
@FunctionalInterface
public static interface Publisher<T> {
public void subscribe(Subscriber<? super T> subscriber);
}
public static interface Subscriber<T> {
public void onSubscribe(Subscription subscription);
public void onNext(T item);
public void onError(Throwable throwable);
public void onComplete();
}
public static interface Subscription {
public void request(long n);
public void cancel();
}
public static interface Processor<T,R> extends Subscriber<T>, Publisher<R> {
}
}
Reactive Streams: goals
1) Avoiding unbounded buffering across async boundaries
2)Inter-op interfaces between various libraries
Reactive Streams: goals
1) Avoiding unbounded buffering across async boundaries
2)Inter-op interfaces between various libraries
Argh, implementing a correct RS Publisher
or Subscriber is so hard!
Reactive Streams: goals
1) Avoiding unbounded buffering across async boundaries
2)Inter-op interfaces between various libraries
Argh, implementing a correct
RS Publisher or Subscriber is so hard!
Reactive Streams: goals
1) Avoiding unbounded buffering across async boundaries
2)Inter-op interfaces between various libraries
Argh, implementing a correct
RS Publisher or Subscriber is so hard!
You should be using
Akka Streams instead!
Already made a huge industry impact!
Reactive Streams
Inspiring other technologies
Inspiring other technologies
It’s been a while since Java inspired
other modern technologies, hasn’t it?
The JVM ecosystem is having
a small renaissance one might say?
Back-pressure as a feature
The implementation.
Complete and awesome Java and Scala APIs.
As everything since day 1 in Akka.
Akka Streams
Akka Streams in 20 seconds:
// types:
Source<Out, Mat>
Flow<In, Out, Mat>
Sink<In, Mat>
// generally speaking, it's always:
val ready =
Source.from…(???).via(flow).map(i -> i * 2).to(sink)
val mat: Mat = ready.run()
// the usual example:
val f: Future<String> =
Source.single(1).map(i -> i.toString).runWith(Sink.head)
Proper static typing!
Source.single(1).map(i -> i.toString).runWith(Sink.head())
Akka Streams in 20 seconds:
// types: _
Source<Int, NotUsed>
Flow<Int, String, NotUsed>
Sink<String, Future<String>>
Source.single(1).map(i -> i.toString).runWith(Sink.head())
// types: _
Source<Int, Unit>
Flow<Int, String, Unit>
Sink<String, Future<String>>
Akka Streams in 20 seconds:
Materialization
Gears from GeeCON.org, did I mention it’s an awesome conf?
What is ā€œmaterializationā€ really?
What is ā€œmaterializationā€ really?
What is ā€œmaterializationā€ really?
What is ā€œmaterializationā€ really?
Codename:
Alpakka
// these are ā€œAlpacassoā€
A community for Streams connectors
Alpakka – a community for Stream connectors
Alp
Alpakka – a community for Stream connectors
Threading & Concurrency in Akka Streams Explained (part I)
Mastering GraphStages (part I, Introduction)
Akka Streams Integration, codename Alpakka
A gentle introduction to building Sinks and Sources using GraphStage APIs
(Mastering GraphStages, Part II)
Writing Akka Streams Connectors for existing APIs
Flow control at the boundary of Akka Streams and a data provider
Akka Streams Kafka 0.11
Alpakka – a community for Stream connectors
Existing examples:
MQTT
AMQP
Streaming HTTP
Streaming TCP
Streaming FileIO
Cassandra Queries
ā€œReactive Kafkaā€ (akka-stream-kafka)
S3, SQS & other Amazon APIs
Streaming JSON
Streaming XML
Alpakka – a community for Stream connectors
Alpakka – a community for Stream connectors
Dynamic Fan-in
Dynamic Fan-out
ā€œComposing building blocksā€
Reactive tracking of job progress
Akka Streams & HTTP
streams
& HTTP
A core feature not obvious to the untrained eye…!
Akka Streams / HTTP
Quiz time!
TCP is a ______ protocol?
A core feature not obvious to the untrained eye…!
Akka Streams / HTTP
Quiz time!
TCP is a STREAMING protocol!
Streaming in Akka HTTP
DEMO
http://doc.akka.io/docs/akka/2.4.7/scala/stream/stream-customize.html#graphstage-scala
ā€œFramed entity streamingā€ https://github.com/akka/akka/pull/20778
HttpServer as a:
Flow[HttpRequest, HttpResponse]
Streaming in Akka HTTP
DEMO
http://doc.akka.io/docs/akka/2.4.7/scala/stream/stream-customize.html#graphstage-scala
ā€œFramed entity streamingā€ https://github.com/akka/akka/pull/20778
HttpServer as a:
Flow[HttpRequest, HttpResponse]
HTTP Entity as a:
Source[ByteString, _]
Streaming in Akka HTTP
DEMO
http://doc.akka.io/docs/akka/2.4.7/scala/stream/stream-customize.html#graphstage-scala
ā€œFramed entity streamingā€ https://github.com/akka/akka/pull/20778
HttpServer as a:
Flow[HttpRequest, HttpResponse]
HTTP Entity as a:
Source[ByteString, _]
Websocket connection as a:
Flow[ws.Message, ws.Message]
It’s turtles buffers all the way down!
Streaming from Akka HTTP
Streaming from Akka HTTP
Streaming from Akka HTTP
No demand from TCP
=
No demand upstream
=
Source won’t generate tweets
=>
Bounded memory
stream processing!
Streaming from Akka HTTP (Java)
public static void main(String[] args) {
final ActorSystem system = ActorSystem.create();
final Materializer materializer = ActorMaterializer.create(system);
final Http http = Http.get(system);
final Source<Tweet, NotUsed> tweets = Source.repeat(new Tweet("Hello world"));
final Route tweetsRoute =
path("tweets", () ->
completeWithSource(tweets, Jackson.marshaller(), EntityStreamingSupport.json())
);
final Flow<HttpRequest, HttpResponse, NotUsed> handler =
tweetsRoute.flow(system, materializer);
http.bindAndHandle(handler,
ConnectHttp.toHost("localhost", 8080),
materializer
);
System.out.println("Running at http://localhost:8080");
}
Streaming from Akka HTTP (Java)
public static void main(String[] args) {
final ActorSystem system = ActorSystem.create();
final Materializer materializer = ActorMaterializer.create(system);
final Http http = Http.get(system);
final Source<Tweet, NotUsed> tweets = Source.repeat(new Tweet("Hello world"));
final Route tweetsRoute =
path("tweets", () ->
completeWithSource(tweets, Jackson.marshaller(), EntityStreamingSupport.json())
);
final Flow<HttpRequest, HttpResponse, NotUsed> handler =
tweetsRoute.flow(system, materializer);
http.bindAndHandle(handler,
ConnectHttp.toHost("localhost", 8080),
materializer
);
System.out.println("Running at http://localhost:8080");
}
Streaming from Akka HTTP (Scala)
object Example extends App
with SprayJsonSupport with DefaultJsonProtocol {
import akka.http.scaladsl.server.Directives._
implicit val system = ActorSystem()
implicit val mat = ActorMaterializer()
implicit val jsonRenderingMode = EntityStreamingSupport.json()
implicit val TweetFormat = jsonFormat1(Tweet)
def tweetsStreamRoutes =
path("tweets") {
complete {
Source.repeat(Tweet(""))
}
}
Http().bindAndHandle(tweetsStreamRoutes, "127.0.0.1", 8080)
System.out.println("Running at http://localhost:8080");
}
Exciting times ahead!
Next steps for Akka
Completely new Akka Remoting (goal: 700.000+ msg/s (!)),
(it is built using Akka Streams, Aeron).
More integrations for Akka Streams stages, project Alpakka.
Reactive Kafka polishing with SoftwareMill.
Akka Typed progressing again, likely towards 3.0.
Akka HTTP 2.0 Proof of Concept in progress.
Of course, continued maintenance of Cluster and others.
Is now the time to adopt
Akka Streams / Reactive Streams?
Totally, go for it.
Happy hAkking!
Akka <3 contributions
• Easy to contribute:
• https://github.com/akka/akka/issues?q=is%3Aissue+is%3Aopen+label%3Aeasy-to-contribute
• https://github.com/akka/akka/issues?q=is%3Aissue+is%3Aopen+label%3A%22nice-to-have+%28low-prio%29%22
• Akka Stream Contrib
• https://github.com/akka/akka-stream-contrib
• (above contains Alpakka, but will be split)
• Mailing list:
• https://groups.google.com/group/akka-user
• Public chat rooms:
• http://gitter.im/akka/dev developing Akka
• http://gitter.im/akka/akka using Akka
Pics
Gundam pictures from: http://www.wallpaperup.com/tag/gundam/3
Free e-book and printed report.
Available soon.
Covers what reactive actually is.
Implementing in existing architectures.
Thoughts from the team that’s building
reactive apps since more than 6 years.
Obligatory ā€œread my book!ā€ slide :-)
ktoso @ typesafe.com
twitter: ktosopl
github: ktoso
team blog: letitcrash.com
home: akka.io
Q/A
ktoso @ lightbend.com
twitter: ktosopl
github: ktoso
team blog: blog.akka.io
home: akka.io

More Related Content

What's hot (20)

PDF
Not Only Streams for Akademia JLabs
Konrad Malawski
Ā 
PDF
State of Akka 2017 - The best is yet to come
Konrad Malawski
Ā 
PDF
Building a Reactive System with Akka - Workshop @ O'Reilly SAConf NYC
Konrad Malawski
Ā 
PDF
Reactive Streams: Handling Data-Flow the Reactive Way
Roland Kuhn
Ā 
PDF
[Tokyo Scala User Group] Akka Streams & Reactive Streams (0.7)
Konrad Malawski
Ā 
PDF
2014 akka-streams-tokyo-japanese
Konrad Malawski
Ā 
PDF
Networks and Types - the Future of Akka @ ScalaDays NYC 2018
Konrad Malawski
Ā 
PDF
Need for Async: Hot pursuit for scalable applications
Konrad Malawski
Ā 
PDF
Fresh from the Oven (04.2015): Experimental Akka Typed and Akka Streams
Konrad Malawski
Ā 
PDF
Reactive Stream Processing with Akka Streams
Konrad Malawski
Ā 
PDF
ScalaSwarm 2017 Keynote: Tough this be madness yet theres method in't
Konrad Malawski
Ā 
PDF
The things we don't see – stories of Software, Scala and Akka
Konrad Malawski
Ā 
PDF
Reactive Streams / Akka Streams - GeeCON Prague 2014
Konrad Malawski
Ā 
PDF
Building reactive distributed systems with Akka
Johan AndrƩn
Ā 
PDF
Streaming all the things with akka streams
Johan AndrƩn
Ā 
PPTX
Akka Actor presentation
Gene Chang
Ā 
PDF
VJUG24 - Reactive Integrations with Akka Streams
Johan AndrƩn
Ā 
PDF
Journey into Reactive Streams and Akka Streams
Kevin Webber
Ā 
PDF
Scala usergroup stockholm - reactive integrations with akka streams
Johan AndrƩn
Ā 
PDF
Reactive Applications in Java
Alexander Mrynskyi
Ā 
Not Only Streams for Akademia JLabs
Konrad Malawski
Ā 
State of Akka 2017 - The best is yet to come
Konrad Malawski
Ā 
Building a Reactive System with Akka - Workshop @ O'Reilly SAConf NYC
Konrad Malawski
Ā 
Reactive Streams: Handling Data-Flow the Reactive Way
Roland Kuhn
Ā 
[Tokyo Scala User Group] Akka Streams & Reactive Streams (0.7)
Konrad Malawski
Ā 
2014 akka-streams-tokyo-japanese
Konrad Malawski
Ā 
Networks and Types - the Future of Akka @ ScalaDays NYC 2018
Konrad Malawski
Ā 
Need for Async: Hot pursuit for scalable applications
Konrad Malawski
Ā 
Fresh from the Oven (04.2015): Experimental Akka Typed and Akka Streams
Konrad Malawski
Ā 
Reactive Stream Processing with Akka Streams
Konrad Malawski
Ā 
ScalaSwarm 2017 Keynote: Tough this be madness yet theres method in't
Konrad Malawski
Ā 
The things we don't see – stories of Software, Scala and Akka
Konrad Malawski
Ā 
Reactive Streams / Akka Streams - GeeCON Prague 2014
Konrad Malawski
Ā 
Building reactive distributed systems with Akka
Johan AndrƩn
Ā 
Streaming all the things with akka streams
Johan AndrƩn
Ā 
Akka Actor presentation
Gene Chang
Ā 
VJUG24 - Reactive Integrations with Akka Streams
Johan AndrƩn
Ā 
Journey into Reactive Streams and Akka Streams
Kevin Webber
Ā 
Scala usergroup stockholm - reactive integrations with akka streams
Johan AndrƩn
Ā 
Reactive Applications in Java
Alexander Mrynskyi
Ā 

Viewers also liked (14)

PDF
Akka Streams and HTTP
Roland Kuhn
Ā 
PDF
Exploring Reactive Integrations With Akka Streams, Alpakka And Apache Kafka
Lightbend
Ā 
PDF
Understanding Akka Streams, Back Pressure, and Asynchronous Architectures
Lightbend
Ā 
PDF
A dive into akka streams: from the basics to a real-world scenario
Gioia Ballin
Ā 
PDF
Reactive Streams 1.0.0 and Why You Should Care (webinar)
Legacy Typesafe (now Lightbend)
Ā 
PDF
100th SCKRK Meeting - best software engineering papers of 5 years of SCKRK
Konrad Malawski
Ā 
PDF
Asynchronous stream processing with Akka Streams
Johan AndrƩn
Ā 
PDF
DDDing Tools = Akka Persistence
Konrad Malawski
Ā 
PDF
Distributed Consensus A.K.A. "What do we eat for lunch?"
Konrad Malawski
Ā 
PDF
Zen of Akka
Konrad Malawski
Ā 
PDF
Akka persistence == event sourcing in 30 minutes
Konrad Malawski
Ā 
PPTX
Lessons Learned From PayPal: Implementing Back-Pressure With Akka Streams And...
Lightbend
Ā 
PPTX
Risking Everything with Akka Streams
johofer
Ā 
PDF
Tackling a 1 billion member social network
Artur Bańkowski
Ā 
Akka Streams and HTTP
Roland Kuhn
Ā 
Exploring Reactive Integrations With Akka Streams, Alpakka And Apache Kafka
Lightbend
Ā 
Understanding Akka Streams, Back Pressure, and Asynchronous Architectures
Lightbend
Ā 
A dive into akka streams: from the basics to a real-world scenario
Gioia Ballin
Ā 
Reactive Streams 1.0.0 and Why You Should Care (webinar)
Legacy Typesafe (now Lightbend)
Ā 
100th SCKRK Meeting - best software engineering papers of 5 years of SCKRK
Konrad Malawski
Ā 
Asynchronous stream processing with Akka Streams
Johan AndrƩn
Ā 
DDDing Tools = Akka Persistence
Konrad Malawski
Ā 
Distributed Consensus A.K.A. "What do we eat for lunch?"
Konrad Malawski
Ā 
Zen of Akka
Konrad Malawski
Ā 
Akka persistence == event sourcing in 30 minutes
Konrad Malawski
Ā 
Lessons Learned From PayPal: Implementing Back-Pressure With Akka Streams And...
Lightbend
Ā 
Risking Everything with Akka Streams
johofer
Ā 
Tackling a 1 billion member social network
Artur Bańkowski
Ā 
Ad

Similar to End to End Akka Streams / Reactive Streams - from Business to Socket (20)

PDF
Reactive Streams, j.u.concurrent, & Beyond!
C4Media
Ā 
PDF
Build Real-Time Streaming ETL Pipelines With Akka Streams, Alpakka And Apache...
Lightbend
Ā 
PPT
Devoxx
Martin Odersky
Ā 
PDF
IPT Reactive Java IoT Demo - BGOUG 2018
Trayan Iliev
Ā 
PDF
Reactive Streams 1.0 and Akka Streams
Dean Wampler
Ā 
PDF
Let the alpakka pull your stream
Enno Runne
Ā 
PPTX
Sviluppare applicazioni nell'era dei "Big Data" con Scala e Spark - Mario Car...
Codemotion
Ā 
PDF
Spark streaming state of the union
Databricks
Ā 
PPT
LarKC Tutorial at ISWC 2009 - Introduction
LarKC
Ā 
PPTX
Scala + Akka + ning/async-http-client - Vancouver Scala meetup February 2015
Yanik Berube
Ā 
PPTX
Sviluppare applicazioni nell'era dei "Big Data" con Scala e Spark - Mario Car...
Codemotion
Ā 
ODP
Drilling the Async Library
Knoldus Inc.
Ā 
PDF
RxJava@DAUG
Maxim Volgin
Ā 
PDF
IPT High Performance Reactive Java BGOUG 2016
Trayan Iliev
Ā 
PDF
Microservices with Spring 5 Webflux - jProfessionals
Trayan Iliev
Ā 
PPT
Reactive java programming for the impatient
Grant Steinfeld
Ā 
PDF
Spring 5 Webflux - Advances in Java 2018
Trayan Iliev
Ā 
PDF
NGRX Apps in Depth
Trayan Iliev
Ā 
PDF
Sigmoid akka stream
Sigmoid
Ā 
PDF
A Quick Intro to ReactiveX
Troy Miles
Ā 
Reactive Streams, j.u.concurrent, & Beyond!
C4Media
Ā 
Build Real-Time Streaming ETL Pipelines With Akka Streams, Alpakka And Apache...
Lightbend
Ā 
Devoxx
Martin Odersky
Ā 
IPT Reactive Java IoT Demo - BGOUG 2018
Trayan Iliev
Ā 
Reactive Streams 1.0 and Akka Streams
Dean Wampler
Ā 
Let the alpakka pull your stream
Enno Runne
Ā 
Sviluppare applicazioni nell'era dei "Big Data" con Scala e Spark - Mario Car...
Codemotion
Ā 
Spark streaming state of the union
Databricks
Ā 
LarKC Tutorial at ISWC 2009 - Introduction
LarKC
Ā 
Scala + Akka + ning/async-http-client - Vancouver Scala meetup February 2015
Yanik Berube
Ā 
Sviluppare applicazioni nell'era dei "Big Data" con Scala e Spark - Mario Car...
Codemotion
Ā 
Drilling the Async Library
Knoldus Inc.
Ā 
RxJava@DAUG
Maxim Volgin
Ā 
IPT High Performance Reactive Java BGOUG 2016
Trayan Iliev
Ā 
Microservices with Spring 5 Webflux - jProfessionals
Trayan Iliev
Ā 
Reactive java programming for the impatient
Grant Steinfeld
Ā 
Spring 5 Webflux - Advances in Java 2018
Trayan Iliev
Ā 
NGRX Apps in Depth
Trayan Iliev
Ā 
Sigmoid akka stream
Sigmoid
Ā 
A Quick Intro to ReactiveX
Troy Miles
Ā 
Ad

Recently uploaded (20)

PPT
Interview paper part 3, It is based on Interview Prep
SoumyadeepGhosh39
Ā 
PDF
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
Ā 
PDF
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
Ā 
PDF
Windsurf Meetup Ottawa 2025-07-12 - Planning Mode at Reliza.pdf
Pavel Shukhman
Ā 
PDF
July Patch Tuesday
Ivanti
Ā 
PPTX
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
Ā 
PDF
Timothy Rottach - Ramp up on AI Use Cases, from Vector Search to AI Agents wi...
AWS Chicago
Ā 
PPTX
UiPath Academic Alliance Educator Panels: Session 2 - Business Analyst Content
DianaGray10
Ā 
PDF
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
Ā 
PDF
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
Ā 
PDF
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
Ā 
PDF
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
Ā 
PPTX
MSP360 Backup Scheduling and Retention Best Practices.pptx
MSP360
Ā 
PDF
SWEBOK Guide and Software Services Engineering Education
Hironori Washizaki
Ā 
PPTX
Building Search Using OpenSearch: Limitations and Workarounds
Sease
Ā 
PDF
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
Ā 
PDF
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
Ā 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
Ā 
PDF
Complete JavaScript Notes: From Basics to Advanced Concepts.pdf
haydendavispro
Ā 
PDF
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
Ā 
Interview paper part 3, It is based on Interview Prep
SoumyadeepGhosh39
Ā 
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
Ā 
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
Ā 
Windsurf Meetup Ottawa 2025-07-12 - Planning Mode at Reliza.pdf
Pavel Shukhman
Ā 
July Patch Tuesday
Ivanti
Ā 
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
Ā 
Timothy Rottach - Ramp up on AI Use Cases, from Vector Search to AI Agents wi...
AWS Chicago
Ā 
UiPath Academic Alliance Educator Panels: Session 2 - Business Analyst Content
DianaGray10
Ā 
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
Ā 
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
Ā 
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
Ā 
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
Ā 
MSP360 Backup Scheduling and Retention Best Practices.pptx
MSP360
Ā 
SWEBOK Guide and Software Services Engineering Education
Hironori Washizaki
Ā 
Building Search Using OpenSearch: Limitations and Workarounds
Sease
Ā 
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
Ā 
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
Ā 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
Ā 
Complete JavaScript Notes: From Basics to Advanced Concepts.pdf
haydendavispro
Ā 
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
Ā 

End to End Akka Streams / Reactive Streams - from Business to Socket

  • 1. Konrad `ktoso` Malawski & Johan AndrĆ©n pic: 1:1 scale Gundam model @ Odaiba, Tokyo streams / Reactive Streams End to end – from Business to Socket
  • 2. Konrad `ktoso` Malawski Akka Team, Reactive Streams TCK, Persistence, HTTP
  • 3. Konrad `@ktosopl` Malawski work: akka.io lightbend.com personal blog: http://kto.so communities: geecon.org Java.pl / KrakowScala.pl sckrk.com GDGKrakow.pl lambdakrk.pl
  • 4. Special thanks to Johan AndrĆ©n for helping prepare the examples. Akka Team Stockholm Scala User Group
  • 5. Nice to meet you! Who are you?
  • 6. Make building powerful concurrent & distributed applications simple. Akka is a toolkit and runtime for building highly concurrent, distributed, and resilient message-driven applications on the JVM
  • 7. Actors – simple & high performance concurrency Cluster / Remoting – location transparency, resilience Cluster Sharding – and more prepackaged patterns Streams – back-pressured stream processing Persistence – Event Sourcing HTTP – complete, fully async and reactive HTTP Server Official Kafka, Cassandra, DynamoDB integrations, tons more in the community Complete Java & Scala APIs for all features (since day 1) Typed coming soon…
  • 11. Suddenly everyone jumped on the word ā€œStreamā€. Akka Streams / Reactive Streams started end-of-2013. ā€œStreamsā€ * when put in ā€œā€ the word does not appear in project name, but is present in examples / style of APIs / wording.
  • 12. Suddenly everyone jumped on the word ā€œStreamā€. Akka Streams / Reactive Streams started end-of-2013. ā€œStreamsā€ Akka Streams Reactive Streams RxJava ā€œstreamsā€* Spark Streaming Apache Storm ā€œstreamsā€* Java Steams (JDK8) Reactor ā€œstreamsā€* Kafka Streams ztellman / Manifold (Clojure) * when put in ā€œā€ the word does not appear in project name, but is present in examples / style of APIs / wording. Apache GearPump ā€œstreamsā€ Apache [I] Streams (!) Apache [I] Beam ā€œstreamsā€ Apache [I] Quarks ā€œstreamsā€ Apache [I] Airflow ā€œstreamsā€ (dead?) Apache [I] Samza Scala Stream Scalaz Streams, now known as FS2 Swave.io Java InputStream / OutputStream / … :-)
  • 16. No no no…! Not THAT Back-pressure! No no no…! Not THAT Back-pressure! What is back-pressure?
  • 19. Why back-pressure? So you’ve built your app and it’s awesome.
  • 20. Why back-pressure? Let’s not smash it horribly under load.
  • 21. Reactive Streams - story: 2013’s impls ~2013: Reactive Programming becoming widely adopted on JVM. - Play introduced ā€œIterateesā€ - Akka (2009) had Akka-IO (TCP etc.) - Ben starts work on RxJava http://blogs.msdn.com/b/rxteam/archive/2009/11/17/announcing-reactive-extensions-rx-for-net-silverlight.aspx http://infoscience.epfl.ch/record/176887/files/DeprecatingObservers2012.pdf - Ingo Maier, Martin Odersky https://github.com/ReactiveX/RxJava/graphs/contributors https://github.com/reactor/reactor/graphs/contributors https://medium.com/@viktorklang/reactive-streams-1-0-0-interview-faaca2c00bec#.69st3rndy Teams discuss need for back-pressure in simple user API. Play’s Iteratee / Akka’s NACK in IO. }
  • 22. Reactive Streams - story: 2013’s impls Play Iteratees – pull back-pressure, difficult API http://blogs.msdn.com/b/rxteam/archive/2009/11/17/announcing-reactive-extensions-rx-for-net-silverlight.aspx http://infoscience.epfl.ch/record/176887/files/DeprecatingObservers2012.pdf - Ingo Maier, Martin Odersky https://github.com/ReactiveX/RxJava/graphs/contributors https://github.com/reactor/reactor/graphs/contributors https://medium.com/@viktorklang/reactive-streams-1-0-0-interview-faaca2c00bec#.69st3rndy Akka-IO – NACK back-pressure; low-level IO (Bytes); messaging API RxJava – no back-pressure, nice API
  • 23. Reactive Streams - expert group founded October 2013 Roland Kuhn (Akka) and Erik Meijer (Rx .NET) meet in Lausanne, while recording ā€œPrinciples of Reactive Programmingā€ Coursera Course. Viktor Klang (Akka), Erik Meijer, Ben Christensen (RxJava) and Marius Eriksen (Twitter) meet at Twitter HQ. The term ā€œreactive non-blocking asynchronous back-pressureā€ gets coined. Afterwards more organisations are invited to join the effort, including Pivotal, RedHat etc.
  • 24. Reactive Streams - expert group founded October 2013 Roland Kuhn (Akka) and Erik Meijer (Rx .NET) meet in Lausanne, while recording ā€œPrinciples of Reactive Programmingā€ Coursera Course. Viktor Klang (Akka), Erik Meijer, Ben Christensen (RxJava) and Marius Eriksen (Twitter) meet at Twitter HQ. The term ā€œreactive non-blocking asynchronous back-pressureā€ gets coined.Goals: - asynchronous - never block (waste) - safe (back-threads pressured) - purely local abstraction - allow synchronous impls.
  • 25. Reactive Streams - expert group founded October 2013 Roland Kuhn (Akka) and Erik Meijer (Rx .NET) meet in Lausanne, while recording ā€œPrinciples of Reactive Programmingā€ Coursera Course. Viktor Klang (Akka), Erik Meijer, Ben Christensen (RxJava) and Marius Eriksen (Twitter) meet at Twitter HQ. The term ā€œreactive non-blocking asynchronous back-pressureā€ gets coined. December 2013 Stephane Maldini & Jon Brisbin (Pivotal Reactor) contacted by Viktor.
  • 26. Reactive Streams - expert group founded October 2013 Roland Kuhn (Akka) and Erik Meijer (Rx .NET) meet in Lausanne, while recording ā€œPrinciples of Reactive Programmingā€ Coursera Course. Viktor Klang (Akka), Erik Meijer, Ben Christensen (RxJava) and Marius Eriksen (Twitter) meet at Twitter HQ. The term ā€œreactive non-blocking asynchronous back-pressureā€ gets coined. December 2013 Stephane Maldini & Jon Brisbin (Pivotal Reactor) contacted by Viktor. Soon after, the ā€œReactive Streamsā€ expert group is formed. Also joining the efforts: Doug Lea (Oracle), EndreVarga (Akka), Johannes Rudolph & 
 Mathias Doenitz (Spray), and many others, including myself join the effort soon after.
  • 27. October 2013 Roland Kuhn (Akka) and Erik Meijer (Rx .NET) meet in Lausanne, while recording ā€œPrinciples of Reactive Programmingā€ Coursera Course. Viktor Klang (Akka), Erik Meijer, Ben Christensen (RxJava) and Marius Eriksen (Twitter) meet at Twitter HQ. The term ā€œreactive non-blocking asynchronous back-pressureā€ gets coined. December 2013 Stephane Maldini & Jon Brisbin (Pivotal Reactor) contacted by Viktor. Soon after, the ā€œReactive Streamsā€ expert group is formed. Also joining the efforts: Doug Lea (Oracle), EndreVarga (Akka), Johannes Rudolph & 
 Mathias Doenitz (Spray), and many others, including myself join the effort soon after. Reactive Streams - expert group founded I ended up implementing much of the TCK. Please use it, let me know if it needs improvements :-)
  • 28. Reactive Streams - story: 2013’s impls 2014–2015: Reactive Streams Spec & TCK development, and implementations. 1.0 released on April 28th 2015, with 5+ accompanying implementations. 2015 Proposed to be included with JDK9 by Doug Lea via JEP-266 ā€œMore Concurrency Updatesā€ http://hg.openjdk.java.net/jdk9/jdk9/jdk/file/6e50b992bef4/src/java.base/share/classes/java/util/concurrent/Flow.java
  • 29. 2014–2015: Reactive Streams Spec & TCK development, and implementations. 1.0 released on April 28th 2015, with 5+ accompanying implementations. 2015 Proposed to be included with JDK9 by Doug Lea via JEP-266 ā€œMore Concurrency Updatesā€ http://hg.openjdk.java.net/jdk9/jdk9/jdk/file/6e50b992bef4/src/java.base/share/classes/java/util/concurrent/Flow.java Reactive Streams - story: 2013’s impls
  • 30. But what does it do!? Reactive Streams
  • 32. Fast Publisher Slow Subscriber Push model
  • 33. Subscriber usually has some kind of buffer. Push model
  • 36. What if the buffer overflows? Push model
  • 37. Use bounded buffer, drop messages + require re-sending Push model
  • 38. Kernel does this! Routers do this! (TCP) Use bounded buffer, drop messages + require re-sending Push model
  • 39. Increase buffer size… Well, while you have memory available! Push model
  • 41. Reactive Streams explained Reactive Streams explained in 1 slide
  • 42. Fast Publisher will send at-most 3 elements. This is pull-based-backpressure. Reactive Streams: ā€œdynamic push/pullā€
  • 43. JEP-266 – soon…! public final class Flow { private Flow() {} // uninstantiable @FunctionalInterface public static interface Publisher<T> { public void subscribe(Subscriber<? super T> subscriber); } public static interface Subscriber<T> { public void onSubscribe(Subscription subscription); public void onNext(T item); public void onError(Throwable throwable); public void onComplete(); } public static interface Subscription { public void request(long n); public void cancel(); } public static interface Processor<T,R> extends Subscriber<T>, Publisher<R> { } }
  • 44. Reactive Streams: goals 1) Avoiding unbounded buffering across async boundaries 2)Inter-op interfaces between various libraries
  • 45. Reactive Streams: goals 1) Avoiding unbounded buffering across async boundaries 2)Inter-op interfaces between various libraries Argh, implementing a correct RS Publisher or Subscriber is so hard!
  • 46. Reactive Streams: goals 1) Avoiding unbounded buffering across async boundaries 2)Inter-op interfaces between various libraries Argh, implementing a correct RS Publisher or Subscriber is so hard!
  • 47. Reactive Streams: goals 1) Avoiding unbounded buffering across async boundaries 2)Inter-op interfaces between various libraries Argh, implementing a correct RS Publisher or Subscriber is so hard! You should be using Akka Streams instead!
  • 48. Already made a huge industry impact! Reactive Streams
  • 50. Inspiring other technologies It’s been a while since Java inspired other modern technologies, hasn’t it? The JVM ecosystem is having a small renaissance one might say?
  • 52. The implementation. Complete and awesome Java and Scala APIs. As everything since day 1 in Akka. Akka Streams
  • 53. Akka Streams in 20 seconds: // types: Source<Out, Mat> Flow<In, Out, Mat> Sink<In, Mat> // generally speaking, it's always: val ready = Source.from…(???).via(flow).map(i -> i * 2).to(sink) val mat: Mat = ready.run() // the usual example: val f: Future<String> = Source.single(1).map(i -> i.toString).runWith(Sink.head) Proper static typing!
  • 54. Source.single(1).map(i -> i.toString).runWith(Sink.head()) Akka Streams in 20 seconds: // types: _ Source<Int, NotUsed> Flow<Int, String, NotUsed> Sink<String, Future<String>>
  • 55. Source.single(1).map(i -> i.toString).runWith(Sink.head()) // types: _ Source<Int, Unit> Flow<Int, String, Unit> Sink<String, Future<String>> Akka Streams in 20 seconds:
  • 56. Materialization Gears from GeeCON.org, did I mention it’s an awesome conf?
  • 61. Codename: Alpakka // these are ā€œAlpacassoā€
  • 62. A community for Streams connectors Alpakka – a community for Stream connectors Alp
  • 63. Alpakka – a community for Stream connectors Threading & Concurrency in Akka Streams Explained (part I) Mastering GraphStages (part I, Introduction) Akka Streams Integration, codename Alpakka A gentle introduction to building Sinks and Sources using GraphStage APIs (Mastering GraphStages, Part II) Writing Akka Streams Connectors for existing APIs Flow control at the boundary of Akka Streams and a data provider Akka Streams Kafka 0.11
  • 64. Alpakka – a community for Stream connectors Existing examples: MQTT AMQP Streaming HTTP Streaming TCP Streaming FileIO Cassandra Queries ā€œReactive Kafkaā€ (akka-stream-kafka) S3, SQS & other Amazon APIs Streaming JSON Streaming XML
  • 65. Alpakka – a community for Stream connectors
  • 66. Alpakka – a community for Stream connectors
  • 70. Reactive tracking of job progress
  • 71. Akka Streams & HTTP streams & HTTP
  • 72. A core feature not obvious to the untrained eye…! Akka Streams / HTTP Quiz time! TCP is a ______ protocol?
  • 73. A core feature not obvious to the untrained eye…! Akka Streams / HTTP Quiz time! TCP is a STREAMING protocol!
  • 74. Streaming in Akka HTTP DEMO http://doc.akka.io/docs/akka/2.4.7/scala/stream/stream-customize.html#graphstage-scala ā€œFramed entity streamingā€ https://github.com/akka/akka/pull/20778 HttpServer as a: Flow[HttpRequest, HttpResponse]
  • 75. Streaming in Akka HTTP DEMO http://doc.akka.io/docs/akka/2.4.7/scala/stream/stream-customize.html#graphstage-scala ā€œFramed entity streamingā€ https://github.com/akka/akka/pull/20778 HttpServer as a: Flow[HttpRequest, HttpResponse] HTTP Entity as a: Source[ByteString, _]
  • 76. Streaming in Akka HTTP DEMO http://doc.akka.io/docs/akka/2.4.7/scala/stream/stream-customize.html#graphstage-scala ā€œFramed entity streamingā€ https://github.com/akka/akka/pull/20778 HttpServer as a: Flow[HttpRequest, HttpResponse] HTTP Entity as a: Source[ByteString, _] Websocket connection as a: Flow[ws.Message, ws.Message]
  • 77. It’s turtles buffers all the way down!
  • 80. Streaming from Akka HTTP No demand from TCP = No demand upstream = Source won’t generate tweets => Bounded memory stream processing!
  • 81. Streaming from Akka HTTP (Java) public static void main(String[] args) { final ActorSystem system = ActorSystem.create(); final Materializer materializer = ActorMaterializer.create(system); final Http http = Http.get(system); final Source<Tweet, NotUsed> tweets = Source.repeat(new Tweet("Hello world")); final Route tweetsRoute = path("tweets", () -> completeWithSource(tweets, Jackson.marshaller(), EntityStreamingSupport.json()) ); final Flow<HttpRequest, HttpResponse, NotUsed> handler = tweetsRoute.flow(system, materializer); http.bindAndHandle(handler, ConnectHttp.toHost("localhost", 8080), materializer ); System.out.println("Running at http://localhost:8080"); }
  • 82. Streaming from Akka HTTP (Java) public static void main(String[] args) { final ActorSystem system = ActorSystem.create(); final Materializer materializer = ActorMaterializer.create(system); final Http http = Http.get(system); final Source<Tweet, NotUsed> tweets = Source.repeat(new Tweet("Hello world")); final Route tweetsRoute = path("tweets", () -> completeWithSource(tweets, Jackson.marshaller(), EntityStreamingSupport.json()) ); final Flow<HttpRequest, HttpResponse, NotUsed> handler = tweetsRoute.flow(system, materializer); http.bindAndHandle(handler, ConnectHttp.toHost("localhost", 8080), materializer ); System.out.println("Running at http://localhost:8080"); }
  • 83. Streaming from Akka HTTP (Scala) object Example extends App with SprayJsonSupport with DefaultJsonProtocol { import akka.http.scaladsl.server.Directives._ implicit val system = ActorSystem() implicit val mat = ActorMaterializer() implicit val jsonRenderingMode = EntityStreamingSupport.json() implicit val TweetFormat = jsonFormat1(Tweet) def tweetsStreamRoutes = path("tweets") { complete { Source.repeat(Tweet("")) } } Http().bindAndHandle(tweetsStreamRoutes, "127.0.0.1", 8080) System.out.println("Running at http://localhost:8080"); }
  • 85. Next steps for Akka Completely new Akka Remoting (goal: 700.000+ msg/s (!)), (it is built using Akka Streams, Aeron). More integrations for Akka Streams stages, project Alpakka. Reactive Kafka polishing with SoftwareMill. Akka Typed progressing again, likely towards 3.0. Akka HTTP 2.0 Proof of Concept in progress. Of course, continued maintenance of Cluster and others.
  • 86. Is now the time to adopt Akka Streams / Reactive Streams?
  • 89. Akka <3 contributions • Easy to contribute: • https://github.com/akka/akka/issues?q=is%3Aissue+is%3Aopen+label%3Aeasy-to-contribute • https://github.com/akka/akka/issues?q=is%3Aissue+is%3Aopen+label%3A%22nice-to-have+%28low-prio%29%22 • Akka Stream Contrib • https://github.com/akka/akka-stream-contrib • (above contains Alpakka, but will be split) • Mailing list: • https://groups.google.com/group/akka-user • Public chat rooms: • http://gitter.im/akka/dev developing Akka • http://gitter.im/akka/akka using Akka
  • 90. Pics Gundam pictures from: http://www.wallpaperup.com/tag/gundam/3
  • 91. Free e-book and printed report. Available soon. Covers what reactive actually is. Implementing in existing architectures. Thoughts from the team that’s building reactive apps since more than 6 years. Obligatory ā€œread my book!ā€ slide :-)
  • 92. ktoso @ typesafe.com twitter: ktosopl github: ktoso team blog: letitcrash.com home: akka.io
  • 93. Q/A ktoso @ lightbend.com twitter: ktosopl github: ktoso team blog: blog.akka.io home: akka.io