Hi,<br><br>I am trying to setup a simple application using Java client (v3.0.2), where a single consumer receives messages from a queue and recovers on failure. I added a heartbeat to my connection, as the network between the client and RabbitMQ is not very reliable. I also implemented ShutdownListener and attached the listener to my connection and channel. When I receive a shutdown signal, I close the connection and the channel, and then attempt to create a new connection and channel. If I fail, I retry after a few seconds. I tested this logic by starting the client and shutting down RabbitMQ, and this works perfectly. However, if I disconnect from the network, channel.close() blocks. I've tried the following two cases:<br>
<ul><li>Attempt calling channel.close() before the shutdown signal is passed to shutdownCompleted(...).<br></li><li>
Attempt calling channel.close() after the shutdown signal is passed to shutdownCompleted(...).</li></ul><p>In both cases channel.close() blocks. In the second one, I can add a flag and avoid calling channel.close(), but in the first case I'm not able to detect if there's a network problem or not.</p>
<p>Should I avoid trying to close channels? Is there a better solution for handling network errors?</p><p>Thank you in advance for your time!</p><p>Kind regards,</p><p>Yiannis<br></p>