func (p *producerImp) Send(topic string, values []ProducerMessage) error {
	var msgs []*sarama.ProducerMessage
	for _, value := range values {
		bytes, err := p.serializer(value)
		if err != nil {
			return err
		}

		msgs = append(msgs, &sarama.ProducerMessage{
			Topic: topic,
			Key:   sarama.StringEncoder(value.GetKey()),
			Value: sarama.ByteEncoder(bytes),
		})
	}

	if len(msgs) > 0 {
		err := p.saramaProducer.SendMessages(msgs)
		return err
	}
	return errors.New("no messages were sent")
}
// Send can be used to send/produce new messages to a topic
Send can be used to send/produce new messages to a topic
// Send can be used to send / produce new messages to a topic
func (p *producerImp) Send(topic string, values []ProducerMessage) error {
	var msgs []*sarama.ProducerMessage
	for _, value := range values {
		bytes, err := p.serializer(value)
		if err != nil {
			return err
		}
		msgs = append(msgs, &sarama.ProducerMessage{
			Topic: topic,
			Key:   sarama.StringEncoder(value.GetKey()),
			Value: sarama.ByteEncoder(bytes),
		})
	}
	if len(msgs) > 0 {
		err := p.saramaProducer.SendMessages(msgs)
		return err
	}
	return errors.New("no messages were sent")
}
func ( p * producerImp ) Send ( topic string , values [ ] ProducerMessage ) error { var msgs [ ] * sarama . ProducerMessage for _ , value := range values { bytes , err := p . serializer ( value ) if err != nil { return err } msgs = append ( msgs , & sarama . ProducerMessage { Topic : topic , Key : sarama . StringEncoder ( value . GetKey ( ) ) , Value : sarama . ByteEncoder ( bytes ) , } ) } if len ( msgs ) > 0 { err := p . saramaProducer . SendMessages ( msgs ) return err } return errors . New ( " " ) }
Send can be used to send/produce new messages to a topic
Send can be used to send / produce new messages to a topic