|
|
@@ -34,7 +34,7 @@ func NewSimpleProducer(client *Client, config *ProducerConfig) (*SimpleProducer,
|
|
|
|
|
|
// SendMessage produces a message to the given topic with the given key and value. To send strings as either key or value, see the StringEncoder type.
|
|
|
func (sp *SimpleProducer) SendMessage(topic string, key, value Encoder) error {
|
|
|
- expectation := make(chan error)
|
|
|
+ expectation := make(chan error, 1)
|
|
|
msg := &MessageToSend{Topic: topic, Key: key, Value: value, Metadata: expectation}
|
|
|
sp.producer.Input() <- msg
|
|
|
return <-expectation
|
|
|
@@ -44,7 +44,7 @@ func (sp *SimpleProducer) handleSuccesses() {
|
|
|
defer sp.wg.Done()
|
|
|
for msg := range sp.producer.Successes() {
|
|
|
expectation := msg.Metadata.(chan error)
|
|
|
- close(expectation)
|
|
|
+ expectation <- nil
|
|
|
}
|
|
|
}
|
|
|
|