I am using scala akka actor model. I have a parent actor create n child actors. Child actors first talk with each other and then report the answer to the master actor. But I could not make it work for the report part. The code structure is as follows:
class Master(n:Int) extends Actor{
val system =ActorSystem("mysystem")
for(i <- 1 to n){
val child=system.actorOf(Props(new Node),name=i.toString)
}
... code let child actor talk with each other ...
def receive={
case _=>"received"
}
}
class Node extends Actor{
def receive={
case => ... some code talking with each other...
var master=context.actorSelection("../Master")
master ! "talk back to master"
}
}
def main() {
val Master=system.actorOf(Props(new Master(10)),name="Master")
}