detecting failure from remote nodes from an akka router

北城以北 提交于 2020-01-04 02:14:08

问题


Lets say I have a router which is configured to create actors on multiple remote nodes. Perhaps I have a configuration like this:

akka {
        actor {
            deployment {
                 /fooRouter {
                router = round-robin
                resizer {
                    lower-bound = 2
                    upper-bound = 10
                }
                target {
                    nodes = ["akka://mana@10.0.1.1:2555", "akka://mana@10.0.1.2:2555"]
                }
            }
        }
    }

If we pretend that one of these nodes, 10.0.1.1, for some reason, has lost connectivity to the database server, so all messages passed to it will result in failure. Is there some way that the router could come to know that the 10.0.1.1 node as effectively useless and stop using it?


回答1:


No, currently there is not. You can have the actors on the failed node commit suicide, but as soon as the resizer starts new ones, they will reappear. Even with clustering support—which is yet to come—this would not be automatic, because connections to some external resource are not part of the cluster’s reachability metric. This means that you would have to write code which takes that node down explicitly, upon which the actors could be migrated to some other node (details are not yet fully fleshed out).

So, currently you would have to write your own router as a real actor, which takes reachability into account.



来源:https://stackoverflow.com/questions/9125377/detecting-failure-from-remote-nodes-from-an-akka-router

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