Hi Nader, it is not completely clear to me what you mean, especially by the "Does not work" comment. Within an FSM you can create child actors just like in any other actor, using "context.actorOf(...<props>..., name)". Child actors enjoy the same kind of encapsulation from all others--including from their parent--so you will need to send messages to communicate with them.
Regards, Roland On Mon, Feb 10, 2014 at 10:24 PM, Nader Aeinehchi <[email protected]>wrote: > Hi > > How can a child actor (which itself implements FSM) be created and added > as a child to the context of a FSM actor? > > Suppose the following pseudocode: > > trait WorkerFSM[S, D] extends FSM[S, D] > > trait ManagerFSM[S, D] extends FSM[S, D] { > > // Does not work > // Create some WorkerFSM actor and add it to the children of this > ManagerFSM > def actorOf[w <: WorkerFSM[S, D]](name: String): FSM[S, D] > } > > The above does not work as only the reference to ActorRed is available to > the client code. In other words, the client code cannot access the method > "actorOf". > > One other alternative is to send messages to ManagerFSM. The problem is > that FSM is coupled to the given state using the construct > when(someState). But here, we would like ManagerFSM to create the child as > long as the actor is preStarted and not stopped (as dictated by Actor's > state diagram and not the fine-grained FSM state diagram). > > Any ideas? > > In advance, thank you very much. > > Nader > > -- > >>>>>>>>>> Read the docs: http://akka.io/docs/ > >>>>>>>>>> Check the FAQ: http://akka.io/faq/ > >>>>>>>>>> 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/groups/opt_out. > -- Akka Team Typesafe - The software stack for applications that scale Blog: letitcrash.com Twitter: @akkateam -- >>>>>>>>>> Read the docs: http://akka.io/docs/ >>>>>>>>>> Check the FAQ: http://akka.io/faq/ >>>>>>>>>> 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/groups/opt_out.
