У меня есть актер с методом получения:
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.