toGroupKey
Converts a message exchange to a grouping key for parallel processing.
This extension function determines how message exchanges are grouped for parallel processing. Exchanges with the same key will be processed sequentially within their group, while different groups can be processed concurrently based on the parallelism level.
A good grouping strategy distributes load evenly across groups while maintaining ordering requirements. Common approaches include:
Hash-based grouping for even distribution
Aggregate ID-based grouping for per-aggregate ordering
Round-robin assignment for simple load balancing
Receiver
The message exchange to group
Return
An integer key for grouping exchanges. Should distribute evenly across available groups.