私は、書籍を学んで、Akkaリモーティングを学んでいます。Akkaを学んでいます。akkaリモコンが見つかりません
制限されたネットワークを使用すると、私はsbtを使用できません(プロキシをうまく設定できません)。
まず、私はapplication.conf
akka {
actor {
provider = remote
}
remote {
emabled-transports = ["akka.remote.netty.tcp"]
netty.tcp {
hostname = "127.0.0.1"
port = 2552
}
}
}
とアッカ・サーバ用のプロジェクトを作成し、コンソールが
Remoting now listens on addresses: [akka.tcp://[email protected]:2552]
目のプロジェクトはJClient
クラスを持つクライアントであるを示しています。
public class JClient {
private static final int TIMEOUT = 2000;
private final ActorSystem system = ActorSystem.create("LocalSystem");
private final ActorSelection remoteDb;
public JClient(String remoteAddress) {
remoteDb = system.actorSelection("akka.tcp://[email protected]" + remoteAddress + "/user/akkademy-db");
}
public CompletionStage set(String key, Object value) {
return toJava(ask(remoteDb, new SetRequest(key, value), TIMEOUT));
}
public CompletionStage<Object> get(String key) {
return toJava(ask(remoteDb, new GetRequest(key), TIMEOUT));
}
}
を
に値「127.0.0.1:2552」を渡します、方法set
/get
を呼び出し、エラーに遭遇:セレクタはフォーマットakka.tcp://${remoteActorSystemName}@${remoteAddress}/user/$actorPath
のストリングであるべきでactorSelection
java.util.concurrent.ExecutionException: akka.pattern.AskTimeoutException: Ask timed out on [ActorSelection[Anchor(akka://akkademy/deadLetters), Path(/user/.*)]] after [2000 ms]. Sender[null] sent message of type "javah.GetRequest".
私remoteURIはアッカに転換した理由を私は知らない:// akkademy/deadletters –