MCPcopy
hub / github.com/segmentio/kafka-go / Murmur2Balancer

Struct Murmur2Balancer

balancer.go:293–296  ·  view source on GitHub ↗

Murmur2Balancer is a Balancer that uses the Murmur2 hash function to determine which partition to route messages to. This ensures that messages with the same key are routed to the same partition. This balancer is compatible with the partitioner used by the Java library and by librdkafka's "murmur2

Source from the content-addressed store, hash-verified

291// keys. We choose librdkafka's implementation because it arguably has a larger
292// install base.
293type Murmur2Balancer struct {
294 Consistent bool
295 random randomBalancer
296}
297
298func (b Murmur2Balancer) Balance(msg Message, partitions ...int) (partition int) {
299 // NOTE: the murmur2 balancers in java and librdkafka treat a nil key as

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected