原使用配置如下:

复制代码
    val config = ConfigFactory.parseString(
        s"""
           |akka.actor.provider="akka.remote.RemoteActorRefProvider"
           |akka.remote.netty.tcp.hostname=$clientHost
           |akka.remote.netty.tcp.port=$clientPort
         """.stripMargin)
    val clientActorSystem = ActorSystem("client", config)
复制代码

 

该配置下,无法指定监听端口,修改配置如下:

复制代码
    val config = ConfigFactory.parseString(
      s"""
         |akka.actor.provider="akka.remote.RemoteActorRefProvider"
         |akka.remote.artery.enable="on"
         |akka.remote.artery.canonical.hostname=$clientHost
         |akka.remote.artery.canonical.port=$clientPort
       """.stripMargin)
    val clientActorSystem = ActorSystem("client", config)
复制代码
posted on 2022-04-04 17:47  啊哈咧  阅读(324)  评论(0编辑  收藏  举报