Top Banner
Akka-streams & Akka-http Pierangelo Cecchetto Java/Scala developer @ @pierangelocecc https://github.com/pierangeloc
26

Display earthquakes with Akka-http

Jan 07, 2017

Download

Technology

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Display earthquakes with Akka-http

Akka-streams & Akka-http

Pierangelo Cecchetto

Java/Scala developer @

@pierangelocecc

https://github.com/pierangeloc

Page 2: Display earthquakes with Akka-http

Akka-streams & Akka-http

- Akka

- Akka-streams

- Akka-http

- Examples and code

Page 3: Display earthquakes with Akka-http

Akka

Akka 101

● Toolkit to build concurrent apps

● “ “ “ distributed “

● Actors can be created/disposed at will

● Small memory footprint

● Hierarchical failure / supervision management

supervises

Page 4: Display earthquakes with Akka-http

Akka

● Actors’ mailbox can be unbounded or bounded but dropping

● Actors interaction: can be complex

● Message passing === messages flow

● Messages are handled in an untyped fashion*

* This is being addressed with Typed Actors

Akka

Page 5: Display earthquakes with Akka-http

Akka-Streams:

- Sequence of ephemeral elements

- Possibly unbounded

- Can be transformed/mapped

- Immutable, reusable, shareable

- Use bounded buffers

- Compose to build complex streams

- Explicit materialization of a blueprint

Akka-streams

Page 6: Display earthquakes with Akka-http

Akka-streams

Akka-streams foundations / 1

Actors based

Synthesized by actors

Page 7: Display earthquakes with Akka-http

Akka-streams

Tools of the trade

Page 8: Display earthquakes with Akka-http

Akka-streams

Flow Transformations

Page 9: Display earthquakes with Akka-http

Flow Transformations

Flow Composition

- Graph builder

- Fan in

- , ,

- Fan out

- ,

Akka-streams

Page 10: Display earthquakes with Akka-http

Akka-streams

Basic composition

Page 11: Display earthquakes with Akka-http

Akka-streams

Materialization: Simple example

Page 12: Display earthquakes with Akka-http

Akka-streams

Materialization: Simple example

Concisely:

Page 13: Display earthquakes with Akka-http

Akka-http

- Streams: back-pressure & buffers

Page 14: Display earthquakes with Akka-http

Akka-http

- Streams: back-pressure & buffers

- TCP: back-pressure & buffers

Page 15: Display earthquakes with Akka-http

Akka-http

- Streams: back-pressure & buffers

- TCP: back-pressure & buffers

- Streams everywhere:

Page 16: Display earthquakes with Akka-http

Akka-http

- Streams: back-pressure & buffers

- TCP: back-pressure & buffers

- Streams everywhere:

Page 17: Display earthquakes with Akka-http

Akka-http

- Streams: back-pressure & buffers

- TCP: back-pressure & buffers

- Streams everywhere:

Think in Streams!

Page 18: Display earthquakes with Akka-http

Akka-http

Routing

Page 19: Display earthquakes with Akka-http

Akka-http

Routing Serving

Page 20: Display earthquakes with Akka-http

Akka-http

Thinking in Streams

example: Stream earthquakes events on a websocket

Page 21: Display earthquakes with Akka-http

Earthquakes replay

Earthquakes stream

websocket

Page 22: Display earthquakes with Akka-http

Earthquakes replay

Earthquakes stream

websocket

Page 23: Display earthquakes with Akka-http

Earthquakes replay

- Data transformation

Page 24: Display earthquakes with Akka-http

Earthquakes replay

- Data transformation

Page 25: Display earthquakes with Akka-http

Earthquakes replay

- Data transformation

Page 26: Display earthquakes with Akka-http

Earthquakes replay

- Data transformation

- Rate transformation