func (p *Murmur2Partitioner) Partition(message *sarama.ProducerMessage, numPartitions int32) (int32, error) {
	if message.Key == nil {
		return p.random.Partition(message, numPartitions)
	}
	bytes, err := message.Key.Encode()
	if err != nil {
		return -1, err
	}
	return Murmur2Partition(bytes, numPartitions), nil
}
// Called by Samza to get the partition for a message.
// Will return a random partition if the message key is nil
Called by Samza to get the partition for a message.
Will return a random partition if the message key is nil
// Called by Samza to get the partition for a message . // Will return a random partition if the message key is nil
func (p *Murmur2Partitioner) Partition(message *sarama.ProducerMessage, numPartitions int32) (int32, error) {
	if message.Key == nil {
		return p.random.Partition(message, numPartitions)
	}
	bytes, err := message.Key.Encode()
	if err != nil {
		return -1, err
	}
	return Murmur2Partition(bytes, numPartitions), nil
}
func ( p * Murmur2Partitioner ) Partition ( message * sarama . ProducerMessage , numPartitions int32 ) ( int32 , error ) { if message . Key == nil { return p . random . Partition ( message , numPartitions ) } bytes , err := message . Key . Encode ( ) if err != nil { return - 1 , err } return Murmur2Partition ( bytes , numPartitions ) , nil }
Called by Samza to get the partition for a message.
Called by Samza to get the partition for a message .