0

我正在学习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启动processingActor2552

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"
    }
  }
}

问题/疑虑

  1. 从日志中,我看到processingActor正在运行WatchingActorSystem而不是在运行ProcessingActorSystem,这是怎么回事?
  2. 我怎样才能看到这两个 ActorSystems 是相互连接的。我没有看到日志记录发生。但是,在示例中,我共享了日志记录。我错过了什么?

整个代码发布在Github上并运行

4

1 回答 1

0

1)您的部署配置设置为使 processingActor 的所有子代都是远程的,如akka 配置文档中所述

您应该将其设置为此:

deployment {
  "/processingActor" {
    remote = "akka.tcp://ProcessingActorSystem@127.0.0.1:2552"
  }

2)您需要将日志级别设置为akka 日志记录文档中描述的有用的东西

于 2015-06-24T07:12:42.533 回答