Created
September 11, 2016 04:30
-
-
Save homerquan/a618afa3bad8d907fecd326c8ec8f613 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
| # AKKA Actor snippets | |
| ## [scala][akka] avoid sender mixing (using pattern match guard) | |
| ``` | |
| def receive = { | |
| case x if sender == child1 => do sth | |
| case x if sender == child2 => do sth else | |
| case x => child forward x | |
| } | |
| ``` | |
| ## [scala][akka] actor selection to actor ref | |
| From: http://stackoverflow.com/questions/10549026/in-akka-how-do-i-know-when-an-actor-is-ready-to-use-after-having-been-registere | |
| ``` | |
| implicit val timeout = Timeout(5, TimeUnit.SECONDS) | |
| val selection = system.actorSelection("/user/myActor") | |
| val actor = Await.result(selection.resolveOne(), timeout.duration) | |
| ``` | |
| ## [scala][akka] I got dead letter and sender changes | |
| * http://stackoverflow.com/questions/20650007/sender-becomes-actorakka-main-deadletters | |
| ## [Scala][akka] chain messagine A->B->C | |
| * Using forward instead of tell (http://stackoverflow.com/questions/25115547/difference-between-forward-and-tell-in-akka-actors) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment