Akka is a very interesting and powerful framework that can be used to build high-performance applications. But what can you do with Akka? This session starts with the basics and then covers some more-advanced topics such as finite-state machines, Akka HTTP, remote actors, clustering, routing, sharing, and persistence. The presentation includes a demo done on a Raspberry Pi Akka cluster. After this session, you’ll know what is possible with Akka and will be able to start using those features yourself.
10. class Worker extends Actor {
def receive = {
case x =>
println(x)
}
}
val system = ActorSystem("ExampleActorSystem")
val workerActorRef = system.actorOf(Props[Worker])
workerActorRef ! "Hello conference"
Scala
19. Scheduling
Actor
Scheduled once after 1 second
Tick
Scheduled every 5 seconds
Tock
system.scheduler.scheduleOnce(1 seconds, scheduleReceiveActor, Tick)
system.scheduler.schedule(0 seconds, 5 seconds, scheduleReceiveActor, Tock)
26. Cluster Worker
Node
Port 2551
Worker
Node
Port 2552
Member Up with IP: 127.0.0.1 and port: 2551
Member Up with IP: 127.0.0.1 and port: 2552
Member Up with IP: 127.0.0.1 and port: 2551
Member Up with IP: 127.0.0.1 and port: 2552
38. Cluster singleton
▪ Only one instance of the actor in the cluster
▪ (Re)created on the oldest node
▪ Can be used for instance for scheduling/caching
50. Sharding
▪ Dividing a set of actors over a cluster
▪ Actors will be divided into groups called shards
▪ It will divide based on a logical identifier
94. Conclusion
▪ Akka can be used with Scala or Java
▪ There is even a .NET version of Akka
▪ Akka is really powerful
▪ Akka is quite easy to use
▪ Some features are still experimental