2. Akka - what is it? 1/2
a platform,
"for building highly concurrent, distributed, and resilient message-driven
applications on the JVM."[1],
based on the actor model.
3. Akka - what is it? 2/2
platform has a lot of specialized extensions
all based on the actor core
goal of the presentation:
explain the core
4. Actor model - what is it?
actor: unit of computation
actors build actor systems
quite "old" (1973).[2]
5. Anatomy of an Akka Actor - intro 1/2
class MyActor extends Actor {
def receive = {
case Something => //...
}
}
7. My first Akka Actor™
class HaiActor extends Actor {
def receive: Receive = {
case target: ActorRef => target ! "Hello!"
case "Hello!" => sender ! "OHAI"
case "OHAI" => println(s"$self: got OHAI from
$sender")
}
}
Where:
type Receive = PartialFunction[Any, Unit]
10. Akka actor model - lifecycle & hierarchy
Purpose:
division of labor
supervision:
each actor has lifecycle
special hooks - preStart, preRestart, postStop
allow for e.g. self-init
"parent" controls how it reacts to failure