ActorSystem, :
import akka.actor.{Actor, Props}
object ShutdownMessage
object KillSwitchActor {
def props : Props = Props[KillSwitchActor]
}
class KillSwitchActor extends Actor {
def receive = {
case ShutdownMessage => context.system.shutdown()
case _ => {}
}
}
KillSwitchActor:
import akka.actor.ActorSystem
val actorSystem : ActorSystem = ActorSystem("testKillSwitch")
val killRef = actorSystem actorOf KillSwitchActor.props
//"Say hello to my little friend!" - Tony Montana
if(someTerminatingCondition) { killRef ! ShutdownMessage }