AKKA-http部署

AKKA-http deployment

这是我第一次使用 akka-http。我写了以下启动应用程序的主要 class:

object Main extends App with Routes with Config with Protocols {
  implicit val system: ActorSystem = ActorSystem("slickboard-system")
  implicit val executor: ExecutionContext = system.dispatcher
  implicit val materializer: ActorMaterializer = ActorMaterializer()

  override val employeeActor: ActorRef = system.actorOf(EmployeeActor.props, "employees")

  val server = Http().bindAndHandle(route, httpServerURL, httpServerPort)
}

它在本地主机上启动服务器,但是当我尝试将它部署到远程 tomcat 服务器时,它不再工作了。它以 HTTP 404 响应:未找到。

我一直在网上搜索 akka-http 部署,但找不到答案。有人遇到过这个问题吗?

亲切的问候

Akka-http 不应部署为 servlet,而是一个独立的可执行文件。部署 Akka 应用程序的一种流行方法是使用 sbt-native-packager 插件。它可以创建特定于系统的包以进行部署,包括 debrpm 带有启动脚本的包,以在 Linux 上提供类似服务的行为。

我最近回答了相关问题,但关于 Play 框架。从部署的角度来看,Play 和 Akka 很相似,所以请看这里:

akka-http 部署了自己的嵌入式网络服务器(嵌入式网络服务器是 akka "evolved" 版本的 spray-can)。尽管 Spray 可以选择部署到外部 Web 服务器(作为 spray servlet),但该功能尚未移植到 akka-http。社区中有人怀疑 spray-servlet 将来会移植到 akka-http。这是因为 akka-http 的发展方式使其与嵌入式服务器的耦合比以往任何时候都更加紧密。