Akka

Evil Monkey Labshttp://blog.evilmonkeylabs.com/2013/01/17/Distributing_Akka_Workloads_And_Shutting_Down_After/

Futurehttp://rbsomeg.blogspot.tw/2012/12/asynch-concurrency-in-promised-land-of.html

AkkA Crash Coursehttp://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. Routerhttp://www.packtpub.com/article/dispatchers-routers

廣告
本篇發表於 Uncategorized。將永久鏈結加入書籤。

發表迴響

在下方填入你的資料或按右方圖示以社群網站登入:

WordPress.com Logo

您的留言將使用 WordPress.com 帳號。 登出 / 變更 )

Twitter picture

您的留言將使用 Twitter 帳號。 登出 / 變更 )

Facebook照片

您的留言將使用 Facebook 帳號。 登出 / 變更 )

Google+ photo

您的留言將使用 Google+ 帳號。 登出 / 變更 )

連結到 %s