Hi,
I want to implement I was looking at this example taken from typesafe 
activator (spray-actor-per-request) 
<http://www.typesafe.com/activator/template/spray-actor-per-request>


class RestRouting extends HttpService with Actor with PerRequestCreator {

implicit def actorRefFactory: ActorContext = context

def receive = runRoute(route)

val petService = context.actorOf(Props[PetClient])
val ownerService = context.actorOf(Props[OwnerClient])

val route = {
 get {
   path("pets") {
          parameters('names) { names =>
    petsWithOwner {
           GetPetsWithOwners(names.split(',').toList)
     }
   }
  }
 }
}

def petsWithOwner(message : RestMessage): Route =
ctx => perRequest(ctx, Props(new GetPetsWithOwnersActor(petService, 
ownerService)), message)
}



and I wonder if this is the best parctice to implement the actors creation :
ctx => perRequest(ctx, Props(new GetPetsWithOwnersActor(petService, 
ownerService)), message)
because I saw at the akka documentation this warning 
<http://doc.akka.io/docs/akka/snapshot/scala/actors.html> regarding 
creating actor within an actor :
val props2 = Props(new ActorWithArgs("arg")) // careful, see below

also if we define an actor within an actor 
val ownerService = context.actorOf(Props[OwnerClient])
how can it be tested ?


Just to make things clear - I am not criticizing, I am just trying to learn 
the best practice of implementation specially as I see the typesafe 
activator as educational source


Best wishes 
Avi

-- 
>>>>>>>>>>      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 [email protected].
To post to this group, send email to [email protected].
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