Skip to content

Commit d499387

Browse files
daixiang0yaron2
andauthored
Fix Kafka binding implements Close() for cleanup (#906)
Signed-off-by: Long Dai <long0dai@foxmail.com> Co-authored-by: Yaron Schneider <yaronsc@microsoft.com>
1 parent 01ca433 commit d499387

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

bindings/kafka/kafka.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,3 +273,13 @@ func updateAuthInfo(config *sarama.Config, saslUsername, saslPassword string) {
273273
ClientAuth: 0,
274274
}
275275
}
276+
277+
func (k *Kafka) Close() error {
278+
if err := k.producer.Close(); err != nil {
279+
k.logger.Errorf("kafka error: failed to close producer: %v", err)
280+
281+
return err
282+
}
283+
284+
return nil
285+
}

0 commit comments

Comments
 (0)