Evil Monkey Labs : http://blog.evilmonkeylabs.com/2013/01/17/Distributing_Akka_Workloads_And_Shutting_Down_After/
Future : http://rbsomeg.blogspot.tw/2012/12/asynch-concurrency-in-promised-land-of.html
AkkA Crash Course : http://rbsomeg.blogspot.tw/2012/12/basics-of-actors-in-scalaakka.html
Before we begin I must draw very strong distinction between an actor (extending Actor
trait) and an actor reference of ActorRef
type. When implementing an actor we extend Actor trait which forces us to implement receive
method. However we do not create instances of actors directly, instead we ask ActorSystem
:
Using the ActorSystem will create top-level actors, supervised by the actor system’s provided guardian actor, while using an actor’s context will create a child actor.
=========================First Message=============================
=========================Request & Respons=========================
=============================Two Actors==========================
Dispatcher
For those of you who don’t know what an Akka Dispatcher is – it’s the engine of Akka, the thing that makes it tick, the thing that makes sure that the available CPU resources are optimally divided between the things that needs to be executed. In other words, it’s at the heart of Akka’s concurrency model.
================================================================
parentActor: akka.actor.ActorRef = Actor[akka://system/user/parent]
Actors have parent-child relationship and parental supervision. An actor is a parent of each actor it creates. In the above line `user` is parent of actor named `parent`. `user` is a one of the system actors that gets created when an actor system is created. User created actors and their children are created underneath `user` system actor. Actors can looked up using `actorFor` on actor system or contenxt. The difference between actorOf and actorFor is that in the later case we get a reference to an ActorRef(If it exists otherwise reference to the dead letter system actor where all messages will passed on in case of no-existent actors) – but actor itself is not created.
================================================================
Dispatcher v.s. Router : http://www.packtpub.com/article/dispatchers-routers