Skip to content

Instantly share code, notes, and snippets.

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