Last active
December 21, 2015 14:58
-
-
Save rkuhn/6322930 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
package demo | |
class TopLevel extends Actor { | |
val db = context.actorOf(Props[Database]) | |
context.watch(db) | |
val web = context.actorOf(Props[WebServer]) | |
web ! Start(database = db) | |
override val supervisorStrategy = OneForOneStrategy() { | |
case _ if sender == db => Stop | |
case _ if sender == web => Restart | |
} | |
def receive = { | |
case Terminated(`db`) => context stop self | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment