val behavior: Behavior[Message] = Behaviors.setup {
actorContext ⇒
logger.info("starting...")
implicit val actorSystem = actorContext.system.asInstanceOf[ActorSystem]
implicit val materializer = ActorMaterializer()(actorContext.asInstanceOf[ActorContext])
implicit val executionContext = actorContext.executionContext
val route =
path("hello") {
get {
complete(HttpEntity(ContentTypes.`text/html(UTF-8)`, "<h1>Say hello to akka-http</h1>"))
}
}
val bindingFuture = Http().bindAndHandle(route, "localhost", 8888)
compiles okay, but when I run my code I get
20:44:22.586 [Leaderboard-akka.actor.default-dispatcher-3] INFO net.kolotyluk.leaderboard.service.REST$ - starting...
[ERROR] [04/02/2018 20:44:22.592] [Leaderboard-akka.actor.default-dispatcher-2] [akka://Leaderboard/user/Http]
akka.actor.typed.internal.adapter.ActorSystemAdapter cannot be cast to akka.actor.ActorSystem
akka.actor.ActorInitializationException: akka://Leaderboard/user/Http: exception during creation
Is there some simple solution to this? How can I give Http()
what it needs for an ActorSystem?
Akka Typed does not seem to play well yet with other Akka libraries