也可以创建嵌套的演员,例如孙子演员,如下所示:
// 这里我们以显式地传递ActorRefFactory为例
val a = actor(system, "fred")(new Act {
val b = actor("barney")(new Act {
whenStarting {context.parent! ("来自...的问候 " + self.path) }
})
become {
case x ⇒ testActor ! x
}
})