I have been writing a few blogs on Actor to log my understanding of Akka. I
happen to take a simple Student Teacher interaction as an analogy to
explain how Actor message passing works. The students sends a mail
(immutable) and the teacher receives the mail from his mailbox at his own
time.

Question 1

1.      Considering the TeacherActor isn’t a subtask of the Student Actor,
I personally think that using context.actorOf is not the right approach to
creating the TeacherActor. Also, it doesn’t sound right semantically.

2.      If the TeacherActor is supposed to be a top-level Actor, I end up
creating one top-level Actor per request – which is wrong again as I
understand that creating top-level actors are expensive. (I understand that
this is because it creates a new ThreadPool per top-level Actor?). I am
thinking of creating the TeacherActor upfront and pass the ActorRef to the
constructor of the Student.

Question 2

Also, as far as I understand,

1.      If you plan to create a child actor, the general guideline is to
pass the Props to the creating actor’s constructor – so that it resurrect
the child Actor if needed.

2.      If you plan to use a top-level Actor, pass in the actual ActorRef
reference (mostly these are supervisors/routers).

Is this a sane understanding?

If anyone is curious, the url is http://rerun.me

-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>      Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to