监督策略

我们遵循两种监督策略来监督任何演员:

  1. 一对一策略

  2. 一对一策略

case object ResumeException extends Exception
 
case object StopException extends Exception
case object RestartException extends Exception
 
override val supervisorStrategy =
 OneForOneStrategy(maxNrOfRetries = 10, withinTimeRange = 1 second){
 case ResumeException => Resume
 case RestartException => Restart
 case StopException => Stop
 case _: Exception => Escalate
 }