Skip to content

Commit

Permalink
Merge pull request #2001 from HurSungYun/async_producer_docs
Browse files Browse the repository at this point in the history
docs: inform AsyncProducer Close pitfalls
  • Loading branch information
bai authored Sep 7, 2021
2 parents 839d956 + 2c8f217 commit 48d19a0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions async_producer.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import (
// to the correct broker for the provided topic-partition, refreshing metadata as appropriate,
// and parses responses for errors. You must read from the Errors() channel or the
// producer will deadlock. You must call Close() or AsyncClose() on a producer to avoid
// leaks: it will not be garbage-collected automatically when it passes out of
// scope.
// leaks and message lost: it will not be garbage-collected automatically when it passes
// out of scope and buffered messages may not be flushed.
type AsyncProducer interface {

// AsyncClose triggers a shutdown of the producer. The shutdown has completed
Expand All @@ -26,7 +26,8 @@ type AsyncProducer interface {

// Close shuts down the producer and waits for any buffered messages to be
// flushed. You must call this function before a producer object passes out of
// scope, as it may otherwise leak memory. You must call this before calling
// scope, as it may otherwise leak memory. You must call this before process
// shutting down, or you may lose messages. You must call this before calling
// Close on the underlying client.
Close() error

Expand Down

0 comments on commit 48d19a0

Please sign in to comment.