Open zhangbiao2009 opened 1 month ago
my-topic does not exist.
my-topic does not exist.
@nodece Thanks for the reply.
I think I got what you mean, the reason why it fails to reconnect because the topic doesn't exist after I re-ran the docker pulsar command, because the topic was stored locally in the docker container, they were lost after I restarted the docker command. This error wouldn't happen in a real environment because topics are stored in BookKeeper. Is that correct?
I also tried specifying a volume for it to store topics persistently:
docker run -it \ -p 6650:6650 \ -p 8080:8080 \ -v pulsar_data:/pulsar/data \ apachepulsar/pulsar:latest \ bin/pulsar standalone
It can reconnect successfully when I repeat my test.
However, I still think this is an issue, I checked the running goroutines when the Topic Not Found
error happened, the consumer.Receive()
still blocks in this case. I think if we cannot reconnect successfully, consumer.Receive()
should return an error, otherwise the caller can do nothing about it but getting stuck there. Do you think so?
We need to introduce the Golang context
, which can help us break the receiving process.
Expected behavior
Expect no error happens.
Actual behavior
Steps to reproduce
error="dial tcp [::1]:6650: connect: connection refused" remote_addr="pulsar://localhost:6650"
Failed to create consumer at reconnect
now.program example to reproduce:
System configuration
Macbook Pro 2021 go version: 1.23.0 pulsar go sdk version: 0.13.1 pulsar broker version: latest docker image. I run it with this command:
docker run -it \ -p 6650:6650 \ -p 8080:8080 \ apachepulsar/pulsar:latest \ bin/pulsar standalone