(message *ProducerMessage, numPartitions int32)
| 265 | } |
| 266 | |
| 267 | func (p *murmur2Partitioner) Partition(message *ProducerMessage, numPartitions int32) (int32, error) { |
| 268 | if message.Key == nil { |
| 269 | return p.random.Partition(message, numPartitions) |
| 270 | } |
| 271 | bytes, err := message.Key.Encode() |
| 272 | if err != nil { |
| 273 | return -1, err |
| 274 | } |
| 275 | return int32(murmur2(bytes)&0x7fffffff) % numPartitions, nil |
| 276 | } |
| 277 | |
| 278 | func (p *murmur2Partitioner) RequiresConsistency() bool { |
| 279 | return true |