From 82362dd83047d9bc9ebbe3752fd5e83f95fb11a3 Mon Sep 17 00:00:00 2001 From: Alireza Mortezaei Date: Mon, 20 Nov 2023 13:18:07 -0500 Subject: [PATCH] MetadataTopics field is now exposed --- writer.go | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/writer.go b/writer.go index 3c7af907..632bce79 100644 --- a/writer.go +++ b/writer.go @@ -477,13 +477,20 @@ func NewWriter(config WriterConfig) *Writer { metadataTTL = 15 * time.Second } + metadataTopic := []string{} + + if len(config.Topic) > 0 { + metadataTopic = append(metadataTopic, config.Topic) + } + transport := &Transport{ - Dial: dial, - SASL: kafkaDialer.SASLMechanism, - TLS: kafkaDialer.TLS, - ClientID: kafkaDialer.ClientID, - IdleTimeout: idleTimeout, - MetadataTTL: metadataTTL, + Dial: dial, + SASL: kafkaDialer.SASLMechanism, + TLS: kafkaDialer.TLS, + ClientID: kafkaDialer.ClientID, + IdleTimeout: idleTimeout, + MetadataTTL: metadataTTL, + MetadataTopics: metadataTopic, } w := &Writer{