title: What is the purpose of RabbitMQ AMQP Java client shutdown handlers?
body: <p>The <a href="http://www.rabbitmq.com/api-guide.html#shutdown" rel="nofollow noreferrer">RabbitMQ documentation</a> presents how to add a shutdown listener and when the listener is called but I fail to see on what purpose the handler is for. Seems that all the Java examples (including <a href="https://github.com/rabbitmq/rabbitmq-tutorials" rel="nofollow noreferrer">https://github.com/rabbitmq/rabbitmq-tutorials</a>) out there ignore shutdown handlers. In which cases should I prefer shutdown listener over simply catching <code>ShutdownSignalException</code> (and <code>IOException</code>) exception ?</p>
  
  <p>Another puzzling issue is that where the control flow goes when the handler has finished.</p>
  
  <p>Potentially relevant related SO questions:</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/6699669">What is the best way to safely end a java application with running RabbitMQ consumers</a></li>
  <li><a href="https://stackoverflow.com/questions/2472278">Using RabbitMQ (Java client), is there a way to determine if network connection is closed during consume?</a></li>
  </ul>