A partitioning key is a stable value that keeps related work together while distributing independent work. In consistent-hashing routing, a message is mapped to a String message key; messages that must be joined, such as those sharing an ID, must always produce the same key. The router hashes that key, selects a virtual node, and sends the message to the routee responsible for it. section 6.3.4
The routing path makes the key’s role explicit: message key, hash code, virtual node, then routee. Virtual nodes improve the chance of even distribution and accommodate routee additions or removals. section 6.3.4
Choose and apply a key with these constraints:
- Derive it from the identity that defines related messages, such as a message ID, rather than from changing message content. section 6.3.4
- Implement a mapping function for each message type; consistent hashing requires the message-to-key mapping explicitly. section 6.3.4
- Configure the virtual-node factor for the router, because each routee serves a configured number of virtual nodes. section 6.3.4
Route aggregation by message ID
An obfuscator and an enricher can each route output to an aggregator using the same message ID as the key. Similar messages then reach the same routee and aggregator, so their pieces can be combined correctly. A group router uses the aggregator ServiceKey together with the consistent-hashing mapping. section 6.3.4
Partitioning also appears at the cluster level. Cluster sharding automatically distributes actors across nodes using a partition key, and uses that same key to communicate with those actors. This combines placement, load balancing, and resilience when nodes leave the cluster. section 8.1









