code: func (c *consumer) consume() ([]*proto.Message, error) {
  	var msgbuf []*proto.Message
  	var retry int
  	for len(msgbuf) == 0 {
  		var err error
  		msgbuf, err = c.fetch()
  		if err != nil {
  			return nil, err
  		}
  		if len(msgbuf) == 0 {
  			if c.conf.RetryWait > 0 {
  				time.Sleep(c.conf.RetryWait)
  			}
  			retry++
  			if c.conf.RetryLimit != -1 && retry > c.conf.RetryLimit {
  				return nil, ErrNoData
  			}
  		}
  	}
  
  	return msgbuf, nil
  }
docs: // consume is returning a batch of messages from consumed partition.
  // Consumer can retry fetching messages even if responses return no new
  // data. Retry behaviour can be configured through RetryLimit and RetryWait
  // consumer parameters.
  //
  // consume can retry sending request on common errors. This behaviour can
  // be configured with RetryErrLimit and RetryErrWait consumer configuration
  // attributes.