MCPcopy
hub / github.com/IBM/sarama / Partitioner

Interface Partitioner

partitioner.go:14–24  ·  partitioner.go::Partitioner

Partitioner is anything that, given a Kafka message and a number of partitions indexed [0...numPartitions-1], decides to which partition to send the message. RandomPartitioner, RoundRobinPartitioner and HashPartitioner are provided as simple default implementations.

Source from the content-addressed store, hash-verified

12// decides to which partition to send the message. RandomPartitioner, RoundRobinPartitioner and HashPartitioner are provided
13// as simple default implementations.
14type Partitioner interface {
15 // Partition takes a message and partition count and chooses a partition
16 Partition(message *ProducerMessage, numPartitions int32) (int32, error)
17
18 // RequiresConsistency indicates to the user of the partitioner whether the
19 // mapping of key->partition is consistent or not. Specifically, if a
20 // partitioner requires consistency then it must be allowed to choose from all
21 // partitions (even ones known to be unavailable), and its choice must be
22 // respected by the caller. The obvious example is the HashPartitioner.
23 RequiresConsistency() bool
24}
25
26// DynamicConsistencyPartitioner can optionally be implemented by Partitioners
27// in order to allow more flexibility than is originally allowed by the

Callers 9

partitionAndAssertFunction · 0.65
TestRandomPartitionerFunction · 0.65
TestHashPartitionerFunction · 0.65
partitionMessageMethod · 0.65

Implementers 6

manualPartitionerpartitioner.go
randomPartitionerpartitioner.go
roundRobinPartitionerpartitioner.go
hashPartitionerpartitioner.go
murmur2Partitionerpartitioner.go
brokePartitionermocks/async_producer_test.go

Calls

no outgoing calls

Tested by

no test coverage detected