0
我有一個演員與接收方法:akka和testkit。不能讓孩子演員
def receive: Actor.Receive = {
case Tick =>
val child = context.system.actorOf(...) // create actor
context.watch(child)
child ! something
case AskRunningJobs =>
log.info(s"My children: ${context.children.toList.length}")
log.info(s"My children: ${context.children.toList.map(_.path.toSerializationFormat).mkString(" ||| ")}")
sender ! RunningJobs(context.children.toList.length)
case unknown =>
log.warning(s"unknown message: $unknown")
}
我有詳細的日誌輸出,我可以清楚地看到所創建的孩子,他們都在運行。但是
context.children.toList.length
總是零。爲什麼? 我正在使用TestKit運行我的演員。
啊,謝謝。我錯過了... – Sergey