Next waits for the next consumer group generation. There will never be two active generations. Next will never return a new generation until the previous one has completed. If there are errors setting up the next generation, they will be surfaced here. If the ConsumerGroup has been closed, then
(ctx context.Context)
| 699 | // |
| 700 | // If the ConsumerGroup has been closed, then Next will return ErrGroupClosed. |
| 701 | func (cg *ConsumerGroup) Next(ctx context.Context) (*Generation, error) { |
| 702 | select { |
| 703 | case <-ctx.Done(): |
| 704 | return nil, ctx.Err() |
| 705 | case <-cg.done: |
| 706 | return nil, ErrGroupClosed |
| 707 | case err := <-cg.errs: |
| 708 | return nil, err |
| 709 | case next := <-cg.next: |
| 710 | return next, nil |
| 711 | } |
| 712 | } |
| 713 | |
| 714 | func (cg *ConsumerGroup) run() { |
| 715 | // the memberID is the only piece of information that is maintained across |