原使用配置如下:
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)