You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for your question!
I'm facing the same situation with a consumer:
client, err := pulsar.NewClient(pulsar.ClientOptions{
URL: "pulsar://localhost:6650",
})
if err != nil {
fmt.Println("Error creating the client:", err)
return
}
defer client.Close()
consumer, err := client.Subscribe(pulsar.ConsumerOptions{
Topic: "persistent://public/default/my-topic",
SubscriptionName: "my-sub",
})
if err != nil {
fmt.Println("Error creating the consumer:", err)
return
}
defer consumer.Close()
for {
// From this point on, no matter what happens with the client's connection,
// my consumer doesn't receive an error about it and keeps waiting for new messages
msg, err := consumer.Receive(context.Background())
if err != nil {
fmt.Println("Error receiving the message:", err)
break
}
fmt.Printf("Message received: %s\n", string(msg.Payload()))
consumer.Ack(msg)
}
This is example the doc shows. I‘m consufed with how to handle the reader. If a connection is aborted(not program close it), would the reader break?
The text was updated successfully, but these errors were encountered: