Skip to content

Instantly share code, notes, and snippets.

@abhirockzz
Created November 30, 2018 10:54
Show Gist options
  • Save abhirockzz/a58de71b4ec4ed0a33153aa383ae154e to your computer and use it in GitHub Desktop.
Save abhirockzz/a58de71b4ec4ed0a33153aa383ae154e to your computer and use it in GitHub Desktop.
func main() {
kafkaBroker := "localhost:9092"
p, _ := kafka.NewProducer(&kafka.ConfigMap{"bootstrap.servers": kafkaBroker})
topic := "bar"
partition := kafka.TopicPartition{Topic: &topic, Partition: kafka.PartitionAny}
msg := &kafka.Message{TopicPartition: partition, Key: []byte("hello"), Value: []byte("world")}
p.Produce(msg, nil)
fmt.Println("done...")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment