Skip to content

Instantly share code, notes, and snippets.

@0sc
Last active August 22, 2016 22:48
Show Gist options
  • Save 0sc/e82b0242773e79c2df654a318168a7cb to your computer and use it in GitHub Desktop.
Save 0sc/e82b0242773e79c2df654a318168a7cb to your computer and use it in GitHub Desktop.
Code snippet for sarama producer described here:
//addresses of available kafka brokers
brokers := []string{'localhost:9201'}
//setup relevant config info
config := sarama.NewConfig()
config.Producer.Partitioner = sarama.NewRandomPartitioner
config.Producer.RequiredAcks = sarama.WaitForAll
producer, err := sarama.NewSyncProducer(brokers, config)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment