Horizontal scaling adds concurrent service instances or processing nodes to increase throughput or capacity. For message receivers, concurrency can disrupt message order; partitioning work helps preserve it. section 8.3.6 section 13.3.1
Two approaches illustrate how horizontal scaling works:
- For message consumers, route messages by shard key to partitioned channels and assign each shard to one receiver; reassign shards as receivers start or stop. section 8.3.6
- For databases, partition data across nodes so adding nodes adds capacity; replication can help maintain availability when a node fails. section 13.3.1
Ordered order events
Three service instances process Order Created, Order Updated, and Order Cancelled messages. Delivering them to different receivers concurrently can produce out-of-order processing; assigning messages to shards by key preserves ordering within the partition. section 8.3.6
Figure 8.15 Scaling consumers while preserving message ordering by using a sharded (partitioned) message channel. The sender includes the shard key in the message. The message broker writes the message to a shard determined by the shard key. The message broker assigns each partition to an instance of the replicated receiver.
Shows how a sender’s shard key determines the message partition and how the broker assigns partitions to receiver instances. section 8.3.6


















