我正在学习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
上运行,出现了什么问题? 整个代码发布在Github上并且也会运行
答案 0 :(得分:0)
1)您的部署配置设置为使processingActor的所有子节点都是远程的,如akka configuration docs
中所述您应该将其设置为:
deployment {
"/processingActor" {
remote = "akka.tcp://ProcessingActorSystem@127.0.0.1:2552"
}
2)您需要将日志级别设置为有用的内容,如akka logging documentation
中所述