Page History
...
Code Block | ||||
---|---|---|---|---|
| ||||
class PrintMyActorRefActor extends Actor {
override def receive: Receive = {
case "printit" =>
val secondRef = context.actorOf(Props.empty, "second-actor") //자식의 생성은 부모만 할수 있다.
println(s"Second: $secondRef")
}
}
val firstRef = system.actorOf(Props[PrintMyActorRefActor], "first-actor")
println(s"First : $firstRef")
firstRef ! "printit"
//액터 생성 순서 first-actor <= second-actor 가 parent <= child 관계가 된다.
First : Actor[akka://testSystem/user/first-actor#1053618476]
Second: Actor[akka://testSystem/user/first-actor/second-actor#-1544706041] |
...