我有一些嵌套的Router,将其创建为FromConfig()。我想要的是这样的:

test {
  akka.actor.deployment {
    /worker {
      router = round-robin
      nr-of-instances = 5
      /slave {
        router = broadcast
        nr-of-instances = 4
      }
    }
  }
}

但是,如果运行此命令,则会出现异常,告诉我[akka://test/user/worker/slave]需要外部配置并建议使用application.conf。

名称正确,并且没有嵌套路由。我想念什么?

编辑
我尝试了另一种配置方式:
test{
  akka.actor.deployment {
    /worker {
      router = round-robin
      nr-of-instances = 5
    }
    /worker/slave {
      router = broadcast
      nr-of-instances = 4
    }
  }
}

这也不起作用。我还认识到,错误的实际位置不是[akka://test/user/worker/slave],而是[akka://test/user/worker/$a/slave]。这让我感到更奇怪。我知道$ a是一个路由,但是如何配置它?

编辑2
感谢您的快速答复。对我来说,这根本不起作用,因为我正在使用scala 2.9.2和akka 2.0。有没有办法在akka 2.0中实现类似的功能?

最佳答案

您可以在部署路径名称中使用通配符:/worker/*/slave

10-07 18:57
查看更多