【问题标题】:Akka with Remote Actors and Durable mailboxes带有远程 Actor 和持久邮箱的 Akka
【发布时间】:2012-04-24 20:25:44
【问题描述】:

我想将 Akka 配置为使用带有 redis 持久邮箱的远程参与者,如下所示。

common.conf 文件:

 akka {
     actor {
         mailbox {
             redis {
                hostname = "127.0.0.1"
                port = 6379
              }
         }
     provider = "akka.remote.RemoteActorRefProvider"   }

   remote {netty {hostname = "127.0.0.1" }}
}

还有我的 application.conf 文件:

calculatorActor {include "common"}
remotecreation {
include "common"
akka {
    actor {
      deployment {
        /advancedCalculator {
          router = "round-robin"
          nr-of-instances = 200
          target {
            nodes = ["akka://CalculatorApplication@127.0.0.1:2552"]
          }

        }
      }
    }
    remote.netty.port = 2554
  }
}

这是从 akka-sample-remote 派生的配置。当我运行应用程序时,我看不到任何与 redis 端(持久邮箱!)的连接。 Redis 日志只包含:

0 clients connected (0 slaves)

【问题讨论】:

  • 只是一个简单的问题,因为您已经问过了。如果两个远程参与者使用相同的 redis 实例,他们是否会共享邮箱?

标签: scala actor akka


【解决方案1】:

您必须指定具有正确邮箱类型的调度程序。

来自文档:

my-dispatcher {
  mailbox-type = akka.actor.mailbox.RedisBasedMailboxType
}

然后用这个调度器创建你的actor:

val myActor = system.actorOf(Props[MyActor].withDispatcher("my-dispatcher"), name = "myactor")

【讨论】:

    猜你喜欢
    • 2014-08-14
    • 2013-02-20
    • 2019-11-24
    • 2012-12-17
    • 1970-01-01
    • 2015-09-09
    • 2016-08-21
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多