Skip to content

Commit

Permalink
add log message with stacktrace on close (#113)
Browse files Browse the repository at this point in the history
add log message with stacktrace on close
  • Loading branch information
JeanMertz authored Sep 5, 2019
2 parents 60baf86 + fd06b59 commit 2d068be
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions streamclient/kafkaclient/consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ func (c *consumer) Nack(m stream.Message) error {
// but it will only effectively close the consumer on the first call.
func (c *consumer) Close() (err error) {
c.once.Do(func() {
c.logger.Info("Request received to close consumer.", zap.Stack("stacktrace"))

// This synchronous call closes the Kafka consumer and also sends any
// still-to-be-committed offsets to the Broker before returning. This is
// done first, so that no new messages are delivered to us, before we close
Expand Down
2 changes: 2 additions & 0 deletions streamclient/kafkaclient/producer.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ func (p *producer) Errors() <-chan error {
// producer on the first call.
func (p *producer) Close() (err error) {
p.once.Do(func() {
p.logger.Info("Request received to close producer.", zap.Stack("stacktrace"))

// Trigger the quit channel, which terminates our internal goroutine to
// process messages, and closes the messages channel. We do this first, to
// prevent sending any left-over messages to a closed rdkafka producer
Expand Down

0 comments on commit 2d068be

Please sign in to comment.