Configurate nested Router in Akka

喜欢而已 提交于 2019-12-23 19:15:20

问题


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
      }
    }
  }
}

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
    }
  }
}

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?

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?


回答1:


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



来源:https://stackoverflow.com/questions/14302929/configurate-nested-router-in-akka

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!