自動生成されたポートを取得する Java クライアントがあります。アクターシステム起動後、ポートにアクセスしたい。
Config clientConfig = ConfigFactory.parseString("akka.remote.netty.tcp.port = 0")
.withFallback(ConfigFactory.parseString("akka.remote.netty.tcp.hostname = " + serverHostName))
.withFallback(ConfigFactory.load("common"));
actorSystem = ActorSystem.create("clientActorSystem", clientConfig);
// how to access the generated port here..!?
その後のログ出力ActorSystem.create(...)
は次のようになるため、ポートはすでに設定されている必要があります。
[INFO] [03/31/2016 14:11:32.042] [main] [akka.remote.Remoting] Starting remoting
[INFO] [03/31/2016 14:11:32.233] [main] [akka.remote.Remoting] Remoting started; listening on addresses :[akka.tcp://actorSystem@localhost:58735]
[INFO] [03/31/2016 14:11:32.234] [main] [akka.remote.Remoting] Remoting now listens on addresses: [akka.tcp://actorSystem@localhost:58735]
を使用して構成を介して取得しようとするとactorSystem.settings().config().getValue("akka.remote.netty.tcp.port")
、以前に定義されたように 0 が取得されます。
このポート (例では 58735) にアクセスする方法を知っている人はいますか?