【发布时间】:2015-09-09 21:49:50
【问题描述】:
我正在学习 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 上运行,但在端口 2552 上启动 processingActor
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上运行,这是怎么回事? - 我怎样才能看到两个 ActorSystem 相互连接。我没有看到日志记录发生。但是,在示例中,我共享了日志记录。我错过了什么?
整个代码发布在Github 上并运行
【问题讨论】:
标签: scala akka typesafe-stack akka-remote-actor