在Akka 2.2.0中,我有一个循环路由的Actor,我希望有一个自定义调度员坐在上面.
在我的application.conf拥有;
durable-dispatcher {
mailbox-type = akka.actor.mailbox.filebased.FileBasedMailboxType
}
akka.actor.deployment {
/notificationServiceWorkers {
dispatcher = durable-dispatcher
router = round-robin
nr-of-instances = 5
}
}
Run Code Online (Sandbox Code Playgroud)
现在当我尝试创造这样的演员时;
ActorRef notificationServiceWorkers = akka.actorOf(Props.create(NotificationServiceActor.class)
.withRouter(new FromConfig()), "notificationServiceWorkers")
Run Code Online (Sandbox Code Playgroud)
调度程序未从配置中获取,它使用默认调度程序.
如果我删除了.withRouter,Akka拿起调度程序的配置就好了,但很明显它不再路由了.
如果我这样添加.withDispatcher;
ActorRef notificationServiceWorkers = akka.actorOf(Props.create(NotificationServiceActor.class)
.withDispatcher("durable-dispatcher")
.withRouter(new FromConfig()), "notificationServiceWorkers")
Run Code Online (Sandbox Code Playgroud)
一切正常.问题是(从doco中不清楚)如果我想从application.conf加载调度程序和路由器配置那么为什么我需要在Props创建中提供这两者?这是一个错误吗?