我想配置Akka使用具有redis持久邮箱的远程actor,如下所示。
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)
答案 0 :(得分:5)
您必须使用正确的邮箱类型指定调度程序。
来自文档:
my-dispatcher {
mailbox-type = akka.actor.mailbox.RedisBasedMailboxType
}
然后使用此调度程序创建您的actor:
val myActor = system.actorOf(Props[MyActor].withDispatcher("my-dispatcher"), name = "myactor")