A partitioner selects the Kafka partition for a record. Producers use it to distribute topic data, while records with the same key are routed to the same partition. section 4.5 section 1.3
A record follows this production path:
- The producer serializes keys and values into byte arrays. section 8.1.2
- The partitioner hashes the key to choose a partition, or uses round-robin distribution when no key is available. section 8.1.2
- The producer buffers messages by partition, forms batches, and sends them to the partition leaders. section 8.1.2
Bank transfer events
A bank transfer application produces an event for each fund transfer. The producer uses a partitioner to select where each event is written, allowing the topic’s partitions to support parallel processing. section 1.3 section 4.5
Figure 1.2 The components and data flow of Kafka
Trace how producers, partitioners, partition leaders, brokers, and consumers participate in Kafka’s data flow. section 1.3
