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

Shutdowns and notifications #473

Open franissirkovic opened 4 years ago

franissirkovic commented 4 years ago

I have encountered the problem using example that exports Session object. Connection sends close notification before channels shutdown. Client must continue to check for channel notifications before trying to reconnect. If client fails to do that channels will not be closed, ie channel destructor will block on notification sending. I would recommend a little modification to the connection shutdown method, that is channels shutdown as a first action in the connection destructor and send notifications after that. Also, I would recommend to check for closed session in openChannel() function. That is, there is no point to allocate new channel for closed connection.