conf := &kafka.ConfigMap{
"bootstrap.servers": "127.0.0.1:9092, 127.0.0.1:9093, 127.0.0.1:9094",
"min.insync.replicas":3,
}
producer, err := kafka.NewProducer(conf)
if err != nil {
log.Println("Error initializing producer: ", err)
}
I have initialized kafka producer in this way using confluent.io package.
producerErr := p.Producer.Produce(&kafka.Message{
TopicPartition: kafka.TopicPartition{
Topic: &topic,
Partition: kafka.PartitionAny,
},
Key: []byte("Message"),
Value: msg,
}, nil)
This is for producing a topic but, How to set replication factor for the topic. Or suggest some way set the no. of broker and replication factor for production.