someview commented on issue #1147:
URL: 
https://github.com/apache/pulsar-client-go/issues/1147#issuecomment-1869980666

   
   
   the Receive is pretty confused with me. Why for range is needed
   ```
   func (c *consumer) Receive(ctx context.Context) (message Message, err error) 
{
        for {
                select {
                case <-c.closeCh:
                        return nil, newError(ConsumerClosed, "consumer closed")
                case cm, ok := <-c.messageCh:
                        if !ok {
                                return nil, newError(ConsumerClosed, "consumer 
closed")
                        }
                        return cm.Message, nil
                case <-ctx.Done():
                        return nil, ctx.Err()
                }
        }
   }
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to