Skip to content

Instantly share code, notes, and snippets.

@pjazdzewski1990
Created May 15, 2015 11:44
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
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