The Sarama library offers two implementations for publishing messages—the sarama.SyncProducer and the sarama.AsyncProducer.
The AsyncProducer offers an asynchronous interface that uses Go channels both for publishing messages and for checking the success of these operations. It allows high-throughput of messages, but is a bit bulky to use if all you want to do is to emit a single message. For this reason, the SyncProducer offers a simpler interface that takes a message for producing and blocks until it receives confirmation from the broker that the message has been successfully published to the event log.
You can instantiate a new Producer using the sarama.NewSyncProducerFromClient and sarama.NewAsyncProducerFromClient ...