What is the difference between /user/master/"+startID
and /user/master/*
? Im assuming the * means that the StartRouteProcess
message is going to sent to all the actors. Is this correct? Whereas, /user/master/"+startID
sends the Task
message to the actor with the given startID
case JoinNode =>
val startID = Nodelist(Random.nextInt(numJoined))
context.system.actorSelection("/user/master/" + startID) ! Task("Join", startID, Nodelist(numJoined), -1)
case BeginRouting =>
println("Node Join Finished.\n")
println("Routing started.")
context.system.actorSelection("/user/master/*") ! StartRouteProcess
According to akka document https://doc.akka.io/docs/akka/2.5/general/addressing.html#querying-the-logical-actor-hierarchy :
Selections may be formulated using the ActorSystem.actorSelection and ActorContext.actorSelection methods and do support sending messages:
context.actorSelection("../*") ! msg
will send msg to all siblings including the current actor.
So you're correct.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.