code: func NewConsumer(config *Config, wg *sync.WaitGroup) (*Consumer, error) {
  	if config.Debug {
  		config.Logger.SetLevel(logging.DebugLevel)
  	}
  	config.Logger.Debug("entering NewConsumer ...")
  	if err := config.ValidateConsumerConfig(); err != nil {
  		return nil, err
  	}
  	config.Logger.Debugf("Consumer config: %#v", config)
  
  	// set consumer config params
  	config.ConsumerConfig().Group.Return.Notifications = config.RecvNotification
  	config.ProducerConfig().Consumer.Return.Errors = config.RecvError
  	config.ConsumerConfig().Consumer.Offsets.Initial = config.InitialOffset
  
  	cClient, err := cluster.NewClient(config.Brokers, config.Config)
  	if err != nil {
  		return nil, err
  	}
  
  	config.Logger.Debug("new client created successfully ...")
  
  	consumer, err := cluster.NewConsumerFromClient(cClient, config.GroupID, config.Topics)
  	if err != nil {
  		return nil, err
  	}
  
  	sConsumer, err := sarama.NewConsumerFromClient(cClient)
  	if err != nil {
  		return nil, err
  	}
  
  	csmr := &Consumer{
  		Logger:       config.Logger,
  		Config:       config,
  		SConsumer:    sConsumer,
  		Consumer:     consumer,
  		closed:       false,
  		closeChannel: make(chan struct{}),
  	}
  
  	// if there is a "waitgroup" arg then use it
  	if wg != nil {
  		csmr.xwg = wg
  		csmr.xwg.Add(1)
  	}
  
  	return csmr, nil
  }
docs: // NewConsumer returns a Consumer instance. If startHandlers is set to true, reading of messages, errors
  // and notifications is started using new consumer. Otherwise, only instance is returned