pulsar-client-go
pulsar-client-go copied to clipboard
Close consumer message channel when consumer closed.
Is your feature request related to a problem? Please describe.
lots of consumer code maybe like this:
for msg := range consumer.Chan(){
// consume msg
}
if not close channel when consumer close, maybe cause goroutine leak.
Describe the solution you'd like
when close a consumer,close the consumer's message channel.
Describe alternatives you've considered
Additional context
Hello, is this a bug or expected behaviour?
Hello, I've also interested in this issue.
Currently it is impossible to detect if consumer closed if you are not using consumer.Receive() method. But this method is blocking and is intended to be used as a receiver of the message.
Maybe we can either add method like Closed() to the interface, or change Receive() method as proposed by issue author?
Just met the same issue. This method would be more useful if you can close the channel.