Skip to content

Commit

Permalink
Improved log printing when a new ConsumerGroup object fails
Browse files Browse the repository at this point in the history
Signed-off-by: axfor <aixiaoxiang2009@hotmail.com>
  • Loading branch information
axfor committed Mar 18, 2023
1 parent 655a6dd commit 90ddffc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/kafka/consumer/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
package consumer

import (
"fmt"
"time"

"github.com/Shopify/sarama"
Expand Down Expand Up @@ -68,7 +69,7 @@ func (c *Configuration) NewConsumer(logger *zap.Logger) (Consumer, error) {
saramaConfig.Consumer.Offsets.CommitInterval = time.Second
client, err := sarama.NewConsumerGroup(c.Brokers, c.GroupID, saramaConfig)
if err != nil {
logger.Panic("error creating consumer group client", zap.Error(err))
return nil, fmt.Errorf("error creating consumer group client: %w", err)
}
return client, err
}

0 comments on commit 90ddffc

Please sign in to comment.