code: func (p *roundRobinProducer) Distribute(topic string, messages ...*proto.Message) (offset int64, err error) {
  	p.mu.Lock()
  	part := p.next
  	p.next++
  	if p.next >= p.partitions {
  		p.next = 0
  	}
  	p.mu.Unlock()
  
  	return p.producer.Produce(topic, int32(part), messages...)
  }
docs: // Distribute write messages to given kafka topic, choosing next destination
  // partition from internal cycle. All messages written within single Produce
  // call are atomically written to the same destination.