Akka

A toolbox for highly concurrent, fault-tolerant services

What is Akka?

  • It brings the Actor Model to the JVM
  • It has separate APIs for Scala and Java
  • Akka is lightweight and modular, so you only use what you need

Ok, so what is an "Actor"?

When an actor receives a message, it can:

  • send messages to other actors
  • create child actors
  • change how it handles the next message it receives

Let it crash!

Actors are typically organized in a tree-like hierarchy:

Parent

Child

Child

Let it crash!

If a child crashes...

Parent

Child

Child

...the parent actor is notified

!

Let it crash!

Depending on its Supervision-Strategy the parent reacts:

(e.g. recreate the child)

Parent

Child

Child

Let it crash!

Akka is more than actors

Akka has many modules which are built on top of simple actors:

  • akka-remote + akka-cluster
  • akka-persistence
  • akka-streams
  • akka-http (incl. Websockets)
  • a lot more official and community modules