From bd2c08aa5325b5a297de35af6410631dd68e8da9 Mon Sep 17 00:00:00 2001 From: Minhyeok Park Date: Fri, 25 Oct 2024 11:22:45 +0900 Subject: [PATCH] feat: modify kafka writer's options --- main.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/main.go b/main.go index 9e4859e..2a1b817 100644 --- a/main.go +++ b/main.go @@ -185,9 +185,12 @@ func main() { } writer := &kafka.Writer{ - Addr: kafka.TCP(strings.Split(KAFKA_BROKERS, ",")...), - Topic: KAFKA_TOPIC, - Balancer: &kafka.LeastBytes{}, + Addr: kafka.TCP(strings.Split(KAFKA_BROKERS, ",")...), + Topic: KAFKA_TOPIC, + AllowAutoTopicCreation: true, + Balancer: &kafka.LeastBytes{}, + BatchTimeout: 10 * time.Millisecond, + Async: true, } app.Post("/api/streams/telemetry", func(c *fiber.Ctx) error {