A hash function turns a message key into a hash code that helps a consistent-hashing router select a virtual node and its routee. Similar messages therefore follow the same routing path when they share a key. section 6.3.4 section 6.3.4
Consistent-hashing routing proceeds through these steps:
- Extract a stable String key from the message, such as its ID, using a message-specific mapping function. section 6.3.4
- Create a hash code from that key and use it to select a virtual node. section 6.3.4
- Send the message to the routee responsible for that virtual node; virtual nodes improve distribution and support route changes. section 6.3.4
Routing messages by ID
Define mapping(command) = command.id, then configure an Akka group router with consistent hashing. Messages carrying the same ID produce the same hash and reach the same routee.















