Ejemplo n.º 1
0
func (this *MirrorMaker) produceRoutine(producer *sarama.Producer, channelIndex int) {
	for msg := range this.messageChannels[channelIndex] {
		var key sarama.Encoder
		if !this.config.PreservePartitions {
			key = sarama.ByteEncoder(msg.Key)
		} else {
			key = Int32Encoder(msg.Partition)
		}
		producer.Input() <- &sarama.ProducerMessage{Topic: this.config.TopicPrefix + msg.Topic, Key: key, Value: sarama.ByteEncoder(msg.Value)}
	}
}
Ejemplo n.º 2
0
func (this *SyslogProducer) produceRoutine(producer *sarama.Producer) {
	for msg := range this.incoming {
		Tracef(this, "Got message: %s", msg)
		producer.Input() <- this.config.Transformer(msg, this.config.Topic)
	}
}