Skip to content

Instantly share code, notes, and snippets.

@pjazdzewski1990
Created May 15, 2015 11:44
Show Gist options
  • Save pjazdzewski1990/f91210062609f636f0bf to your computer and use it in GitHub Desktop.
Save pjazdzewski1990/f91210062609f636f0bf to your computer and use it in GitHub Desktop.
class GameManager extends Actor {
override def receive = {
case CreateGame =>
val id = GameId.createRandom
context.actorOf(GameActor.props(id), id.value)
sender() ! GameCreated(id)
case SendCommand(gameId, command) =>
context.child(gameId.value) match {
case Some(game) => game forward command
case None => sender() ! GameDoesNotExist
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment