Consistent hashing assigns related messages to the same routee, preserving message affinity as routees join or leave. In a worker pipeline, it lets obfuscation and enrichment results reach the same aggregator instead of being merged incorrectly. section 6.3.4
A consistent-hashing router follows this path:
- Convert each message into a string key. section 6.3.4
- Hash the key and use the result to select a routee deterministically. section 6.3.4 section 6.5
- Use the same mapping for corresponding worker outputs, so the aggregator receives both pieces of one original message. section 6.3.4
Routing enrichment results to the matching aggregator
Define the aggregator key as the message id, then configure a group router with consistent hashing: Routers.group(Aggregator.serviceKey).withConsistentHashingRouting(10, Aggregator.mapping). The enricher sends Aggregator.Enriched(id, content + ":metadata"), allowing matching results to reach the same aggregator.

