【问题标题】:akka remote actor running on local actor在本地actor上运行的akka​​远程actor
【发布时间】: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"
    }
  }
}

问题/疑虑

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

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

【问题讨论】:

    标签: scala akka typesafe-stack akka-remote-actor


    【解决方案1】:

    1) 您的部署配置设置为使 processingActor 的所有子代都处于远程状态,如 akka configuration docs 中所述

    您应该将其设置为:

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

    2) 您需要将日志级别设置为akka logging documentation 中描述的有用的东西

    【讨论】:

      猜你喜欢
      • 2016-08-21
      • 1970-01-01
      • 1970-01-01
      • 2023-04-02
      • 1970-01-01
      • 2023-03-17
      • 2013-02-02
      • 1970-01-01
      • 2019-07-07
      相关资源
      最近更新 更多