akka/akka-core

Clarification for typed GroupRouter comment on sending messages to unreachable cluster nodes

オープン

#29,389 opened on 2020/07/16

 (2 件のコメント) (0 件のリアクション) (0 人の担当者)Scala (3,547 件のフォーク)batch import
1 - triagedhelp wantedt:docst:typed

Repository metrics

Stars
 (13,277 個のスター)
PR merge metrics
 (平均マージ 8d 19h) (30d で 10 merged PRs)

説明

In the documentation for the GroupRouter, it states the following:

https://github.com/akka/akka/blob/6d290d66992429ed54af35e7354cb38770b449e6/akka-actor-typed/src/main/scala/akka/actor/typed/scaladsl/Routers.scala#L18

Taking a closer look at the implementation, when the GroupRouter receives the collection of possible routees from the receptionist, it uses an unapply method that filters based on reachable nodes (at least based on the associated comment indicates). As such, it seems the router tries, at least somewhat, to avoid unreachable nodes.

Is this a correct understanding of the GroupRouter's implementation?

New documentation could instead say:

The GroupRouter routes messages to the currently known reachable nodes, but there is always a chance that a node becomes unreachable as the router sends a message.

References for the GroupRouter's use of unapply, the definition of that unapply, and the associated reference to the serviceInstances method used in the unapply:

https://github.com/akka/akka/blob/6d290d66992429ed54af35e7354cb38770b449e6/akka-actor-typed/src/main/scala/akka/actor/typed/internal/routing/GroupRouterImpl.scala#L77-L84

https://github.com/akka/akka/blob/6d290d66992429ed54af35e7354cb38770b449e6/akka-actor-typed/src/main/scala/akka/actor/typed/receptionist/Receptionist.scala#L56-L75

https://github.com/akka/akka/blob/6d290d66992429ed54af35e7354cb38770b449e6/akka-actor-typed/src/main/scala/akka/actor/typed/receptionist/Receptionist.scala#L354-L368

コントリビューターガイド