Skip to content

Instantly share code, notes, and snippets.

@searler
Created June 15, 2016 02:04
Show Gist options
  • Save searler/fc2e0d33efc3e03aad8873e2ab408263 to your computer and use it in GitHub Desktop.
Save searler/fc2e0d33efc3e03aad8873e2ab408263 to your computer and use it in GitHub Desktop.
Akka HTTP command route using Objects
def command(marker:Command) = path("app" / "command" / marker.toString) {
post {
entity(as[String]) { _ =>
actorRef ! marker
complete(StatusCodes.OK)
}
}
}
trait Command
case object Reboot extends Command
case object RotateLogs extends Command
val route = command(Reboot) ~
command(RotateLogs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment