我正在学习akka-remote
并尝试自己重做http://www.typesafe.com/activator/template/akka-sample-remote-scala。
当我尝试在两个单独的 JVM 中运行项目时,我看到
$ clear;java -jar akkaio-remote/target/akka-remote-jar-with-dependencies.jar com.harit.akkaio.remote.RemoteApp ProcessingActor
ProcessingActorSystem Started
和
$ clear;java -jar akkaio-remote/target/akka-remote-jar-with-dependencies.jar com.harit.akkaio.remote.RemoteApp WatchingActor
WatchingActorSystem Started
asking processor to process
processing big things
我让我Processing System
在端口上运行2552
include "common"
akka {
# LISTEN on tcp port 2552
remote.netty.tcp.port = 2552
}
我告诉我的另一个系统(WatchingSystem
)在端口上运行但在端口上2554
启动processingActor
2552
include "common"
akka {
actor {
deployment {
"/processingActor/*" {
remote = "akka.tcp://ProcessingActorSystem@127.0.0.1:2552"
}
}
}
remote.netty.tcp.port = 2554
}
并且common
是关于使用正确的提供者
akka {
actor {
provider = "akka.remote.RemoteActorRefProvider"
}
remote {
netty.tcp {
hostname = "127.0.0.1"
}
}
}
问题/疑虑
- 从日志中,我看到
processingActor
正在运行WatchingActorSystem
而不是在运行ProcessingActorSystem
,这是怎么回事? - 我怎样才能看到这两个 ActorSystems 是相互连接的。我没有看到日志记录发生。但是,在示例中,我共享了日志记录。我错过了什么?
整个代码发布在Github上并运行