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