Display earthquakes with Akka-http

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

Transcript of Display earthquakes with Akka-http

Akka-streams & Akka-http

Pierangelo Cecchetto

Java/Scala developer @

@pierangelocecc

https://github.com/pierangeloc

Akka-streams & Akka-http

- Akka

- Akka-streams

- Akka-http

- Examples and code

Akka

Akka 101

● Toolkit to build concurrent apps

● “ “ “ distributed “

● Actors can be created/disposed at will

● Small memory footprint

● Hierarchical failure / supervision management

supervises

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

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

Akka-streams

Akka-streams foundations / 1

Actors based

Synthesized by actors

Akka-streams

Tools of the trade

Akka-streams

Flow Transformations

Flow Transformations

Flow Composition

- Graph builder

- Fan in

- , ,

- Fan out

- ,

Akka-streams

Akka-streams

Basic composition

Akka-streams

Materialization: Simple example

Akka-streams

Materialization: Simple example

Concisely:

Akka-http

- Streams: back-pressure & buffers

Akka-http

- Streams: back-pressure & buffers

- TCP: back-pressure & buffers

Akka-http

- Streams: back-pressure & buffers

- TCP: back-pressure & buffers

- Streams everywhere:

Akka-http

- Streams: back-pressure & buffers

- TCP: back-pressure & buffers

- Streams everywhere:

Akka-http

- Streams: back-pressure & buffers

- TCP: back-pressure & buffers

- Streams everywhere:

Think in Streams!

Akka-http

Routing

Akka-http

Routing Serving

Akka-http

Thinking in Streams

example: Stream earthquakes events on a websocket

Earthquakes replay

Earthquakes stream

websocket

Earthquakes replay

Earthquakes stream

websocket

Earthquakes replay

- Data transformation

Earthquakes replay

- Data transformation

Earthquakes replay

- Data transformation

Earthquakes replay

- Data transformation

- Rate transformation