You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

18 rivejä
317 B

  1. package kafkaclient
  2. import (
  3. "time"
  4. "github.com/segmentio/kafka-go"
  5. )
  6. func KafkaWriter(kafkaURL, topic string) *kafka.Writer {
  7. return &kafka.Writer{
  8. Addr: kafka.TCP(kafkaURL),
  9. Topic: topic,
  10. Balancer: &kafka.LeastBytes{},
  11. BatchSize: 100,
  12. BatchTimeout: 10 * time.Millisecond,
  13. }
  14. }