overflow_gateway_probe/external/kafka/client.go

24 lines
329 B
Go
Raw Normal View History

2018-04-01 09:39:05 +00:00
package kafka
import (
"context"
"fmt"
"github.com/segmentio/kafka-go"
)
func Send(key []byte, value []byte) error {
if nil == kafkaWriter {
return fmt.Errorf("Kafka client is not valid")
}
err := kafkaWriter.WriteMessages(context.Background(),
kafka.Message{
Key: key,
Value: value,
},
)
return err
}