Skip to content

Instantly share code, notes, and snippets.

@sam
Created July 29, 2014 14:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sam/66a622f2c93dca78b86d to your computer and use it in GitHub Desktop.
Save sam/66a622f2c93dca78b86d to your computer and use it in GitHub Desktop.
Akka Props are a closure?
// 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())}")
@sam
Copy link
Author

sam commented Jul 29, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment