Created
June 1, 2015 08:21
-
-
Save stefanobaghino/63d5460215a6257a82db 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 warboys | |
import akka.actor._ | |
object WarBoyActor { | |
def props: Props = Props(new WarBoyActor) | |
case object WitnessMe | |
} | |
class WarBoyActor extends Actor with ActorLogging { | |
import WarBoyActor._ | |
@throws[Exception](classOf[Exception]) | |
override def preStart(): Unit = { | |
super.preStart() | |
log.info("I LIVE! I DIE! I LIVE AGAIN!") | |
} | |
@throws[Exception](classOf[Exception]) | |
override def postStop(): Unit = { | |
super.postStop() | |
log.info("WITNESS ME!") | |
} | |
def receive: Receive = { | |
case WitnessMe => | |
context.watch(sender) | |
log.info("MEDIOCRE!") | |
case Terminated(_) => | |
log.info("I WITNESS YOU!") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment