Typed consistent hashing example (#30036)

Co-authored-by: Renato Cavalcanti <renato@cavalcanti.be>
This commit is contained in:
franciscolopezsancho 2021-04-01 08:31:42 +01:00 committed by GitHub
parent 55ec18962c
commit fb432b3d8a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 154 additions and 2 deletions

View file

@ -139,6 +139,13 @@ hash key. This makes the decision transparent for the sender.
Consistent hashing delivers messages with the same hash to the same routee as long as the set of routees stays the same.
When the set of routees changes, consistent hashing tries to make sure, but does not guarantee, that messages with the same hash are routed to the same routee.
Scala
: @@snip [RouterSpec.scala](/akka-actor-typed-tests/src/test/scala/docs/akka/typed/RouterSpec.scala) { #consistent-hashing }
Java
: @@snip [RouterTest.java](/akka-actor-typed-tests/src/test/java/jdocs/akka/typed/RouterTest.java) { #consistent-hashing }
See also @ref[Akka Cluster Sharding](cluster-sharding.md) which provides stable routing and rebalancing of the routee actors.
## Routers and performance