Created
July 29, 2014 14:18
-
-
Save sam/66a622f2c93dca78b86d to your computer and use it in GitHub Desktop.
Akka Props are a closure?
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
// It seems like Props is a closure that gets reused? The first pass will work. | |
// The next will cause the BatchUpdate Actor to send deadLetters. As if the sender | |
// terminated prematurely. | |
query { | |
Rows(multiStoryQuery(revs.map(_._1)).list) | |
} pipeTo context.actorOf(Props(new BatchUpdate(context.sender(), revs)), s"batch-update-story-${Math.abs(Random.nextInt())}") | |
// This works however. So the problem actually seems to be that successive iterations of the above | |
// version go to the same (now stopped) passed sender. | |
val sender = context.sender() | |
query { | |
Rows(multiStoryQuery(revs.map(_._1)).list) | |
} pipeTo context.actorOf(Props(new BatchUpdate(sender, revs)), s"batch-update-story-${Math.abs(Random.nextInt())}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
NOTE, here's an apparent explanation: http://letitcrash.com/post/49001044816/2-2-spotlight-deprecation-of-closure-taking-props