liveBook · Manning

Partition

As explained in Microservices Patterns, Second Edition

A partition is an independently ordered subdivision of a distributed message stream that supports parallel processing.

A partition is an independently ordered channel within a sharded message stream. It lets multiple receivers process separate partitions concurrently while preserving order within each partition. section 8.3.3 section 8.3.6

The sender includes a shard key in each message. The broker uses that key to select a partition, then assigns each partition to one receiver in a group. Assignments can change as receivers start or stop. Global ordering can limit throughput and scalability. section 8.3.6 section 8.3.3

Ordering order events

Use orderId as the shard key for Order Created, Order Updated, and Order Cancelled events. Events for each order reach the same partition and are processed in order by one receiver. 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.
ShardedChannel

Trace how the shard key determines a partition and how the broker assigns partitions to receiver instances. section 8.3.6

How Microservices Patterns, Second Edition covers it

How deep it goes
Explains shard-key routing, receiver grouping, dynamic assignment, and ordering within each partition.
Examples
Uses orderId to route order lifecycle events so each order’s events stay in sequence.
What you can do after
Apply partitioning by routing messages with a shard key and assigning each partition to one receiver.
How it connects
Connects partitions with shard keys, competing consumers, consumer groups, and message ordering.

Also explained in

Compare how 4 books explain partition →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Microservices Patterns, Second Edition. The section links point to the parts of the book it draws on.