dsmlily opened a new issue #140: consumer is closed, but consumer.Recieve() is 
blocked instead of throwing an exception
URL: https://github.com/apache/pulsar-client-go/issues/140
 
 
   
           client, err := pulsar.NewClient(pulsar.ClientOptions{URL: 
"pulsar://localhost:6650"})
        if err != nil {
                log.Fatal(err)
        }
   
        defer client.Close()
   
        consumer, err := client.Subscribe(pulsar.ConsumerOptions{
                Topic:            "topic1",
                SubscriptionName: "my-sub",
                Type:             pulsar.Shared,
        })
        if err != nil {
                log.Fatal(err)
        }
   
        if err := consumer.Unsubscribe(); err != nil {
                log.Fatal(err)
        } 
        consumer.Close()
   
        for  {
                fmt.Printf("receive msg ...")
                msg, err := consumer.Receive(context.Background())
                if err != nil {
                        log.Fatal(err)
                }
   
                fmt.Printf("Received message msgId: %#v -- content: '%s'\n",
                        msg.ID(), string(msg.Payload()))
   
                consumer.Ack(msg)
        }
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to