Java doc sample for consistent hashing router, see #944
* Allow return null as undefined ConsistentHashMapping
This commit is contained in:
parent
d59612609f
commit
48a0fda991
6 changed files with 159 additions and 11 deletions
|
|
@ -287,10 +287,10 @@ insight into how consistent hashing is implemented.
|
|||
There is 3 ways to define what data to use for the consistent hash key.
|
||||
|
||||
* You can define ``withConsistentHashMapping`` of the router to map incoming
|
||||
messages to their consistent hash key. This makes the makes the decision
|
||||
messages to their consistent hash key. This makes the the decision
|
||||
transparent for the sender.
|
||||
|
||||
* The messages may implement ``akka.routing.ConsistentHashable``.
|
||||
* The messages may implement ``akka.routing.ConsistentHashingRouter.ConsistentHashable``.
|
||||
The key is part of the message and it's convenient to define it together
|
||||
with the message definition.
|
||||
|
||||
|
|
@ -303,7 +303,11 @@ the same time for one router. The ``withConsistentHashMapping`` is tried first.
|
|||
|
||||
Code example:
|
||||
|
||||
FIXME Java example of consistent routing
|
||||
.. includecode:: code/docs/jrouting/ConsistentHashingRouterDocTestBase.java
|
||||
:include: imports1,cache-actor
|
||||
|
||||
.. includecode:: code/docs/jrouting/ConsistentHashingRouterDocTestBase.java
|
||||
:include: imports2,consistent-hashing-router
|
||||
|
||||
In the above example you see that the ``Get`` message implements ``ConsistentHashable`` itself,
|
||||
while the ``Entry`` message is wrapped in a ``ConsistentHashableEnvelope``. The ``Evict``
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue