在Akka中配置嵌套路由器 [英] Configurate nested Router in Akka

查看:103
本文介绍了在Akka中配置嵌套路由器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些嵌套的路由器,应该在 FromConfig()中创建。我想要的是这样的东西:

I have some nested Router, which shall be created FromConfig(). What I want is something like this:

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。

But if I run this, I get an exception, telling me, that [akka://test/user/worker/slave] needs external configuration and suggests application.conf.

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

The names are correct and without the nested routing it worked. What am I missing?

编辑

我尝试了另一种配置方式:

Edit
I tried another way to configurate:

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是一个路由,但是我该如何配置呢?

This isn't working neither. I also recognized, that the actual position of the error is not [akka://test/user/worker/slave], but [akka://test/user/worker/$a/slave]. That makes it even more weired for me. I understand, that $a is a routee, but how can I configurate it?

编辑2

谢谢快速回复。对我来说,这根本不起作用,因为我正在使用scala 2.9.2和akka 2.0。

Edit 2
Thank you for your quick replys. For me this does not work at all because I am using scala 2.9.2 and akka 2.0. Is there a way to achieve something similar in akka 2.0?

推荐答案

您可以在部署路径名称中使用通配符: /工人/ * /奴隶

You can use wildcard in the deployment path name: /worker/*/slave

这篇关于在Akka中配置嵌套路由器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆