1

我是 akka 监督的新手,我想知道当我们收到询问超时异常时哪种监督策略好,更合适的 Restart 或 Resume 这里是示例代码

class ActorA extends Actor{
override val supervisorStrategy = OneForOneStrategy(
                                    maxNrOfRetries = 10, withinTimeRange = 10 seconds) {
    case _:AskTimeoutException => ??? (Resume/Restart)
    case _:Exception => Restart
  } 
 val actorB =context.actorof ...//actor creation code
 implicit val timeout = Timeout(interval , SECONDS)
  val future  = ask(actorB, MessageB).mapTo[Boolean] //what if actorB does not reply withing the time and AskTimeoutException is thrown the what should be the supervision strategy 
  var response = Await.result(future, timeout.duration)


}

请指导我,谢谢

4

0 回答 0