Created
May 20, 2015 19:08
-
-
Save jamie-allen/d88122cf8e91eb14a40c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import akka.actor.Actor | |
import akka.actor.OneForOneStrategy | |
import akka.actor.SupervisorStrategy.Stop | |
import akka.actor.ActorSystem | |
import akka.actor.Props | |
import akka.actor.ActorInitializationException | |
class TestActorParent extends Actor { | |
override val supervisorStrategy = OneForOneStrategy() { | |
case a: ActorInitializationException => { | |
println("GOT THE AIE") | |
Stop | |
} | |
case StartUpException => { | |
println("GOT HERE!") | |
Stop | |
} | |
} | |
val child = context.actorOf(Props[TestActorChild]) | |
def receive = { | |
case _ => println("got parent message") | |
} | |
} | |
case object StartUpException extends Exception | |
class TestActorChild extends Actor { | |
override def preStart = { | |
throw StartUpException | |
} | |
def receive = { | |
case _ => println("got child message") | |
} | |
} | |
object Bootstrap extends App { | |
val system = ActorSystem() | |
system.actorOf(Props[TestActorParent]) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment