streadway / amqp

Go client for AMQP 0.9.1
http://godoc.org/github.com/streadway/amqp
BSD 2-Clause "Simplified" License
4.88k stars 621 forks source link

Is there non-hacky way to check if channel is closed? #441

Open sev3ryn opened 4 years ago

sev3ryn commented 4 years ago

Is there a way to find out if channel is closed without having separate goroutine that watches channel.NotifyClose events. I'm trying to implement channel pool and I'd like to check if channel is closed when getting it from pool.

For now I'm using workaround by checking errors on QueueInspect on some dummy queue.

Related question on SO: https://stackoverflow.com/questions/17108426/how-to-check-if-the-channel-is-still-working-in-golangs-rabbitmq-client

eibrunorodrigues commented 3 years ago

I couldn't find a simple way to do it. But to get this done is quite simple. So I created a pull request #486