Created
November 15, 2017 19:34
-
-
Save homerquan/12fe757980f73ce361b7a2efbfaf8952 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# Stop an actor | |
## PoisonPill Messages | |
A PoisonPill message has special handling for all actors, including for routers. When any actor receives a PoisonPill message, that actor will be stopped. See the PoisonPill documentation for details. | |
```scala | |
import akka.actor.PoisonPill | |
router ! PoisonPill | |
``` | |
## Stop context | |
https://doc.akka.io/docs/akka/2.5/scala/actors.html#stopping-actors | |
```scala | |
class MyActor extends Actor { | |
val child: ActorRef = ??? | |
def receive = { | |
case "interrupt-child" => | |
context stop child | |
case "done" => | |
context stop self | |
} | |
} | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment