title: How to catch ActiveMQ threads exceptions that are thrown inside a MessageListener
body: <p>I am programming an ActiveMq 5.9 MessageListener. I'm able to get the messages from the broker properly, but my concern is about how to handle exception cases. 
  For instance when the ActiveMq broker is shutdown while the listener is still up, the listener prints the following log:</p>
  
  <pre><code>2014-04-16 17:38:50,559 DEBUG [ActiveMQ Transport: tcp://localhost/127.0.0.1:61616@55509] ActiveMQConnection - Async exception with no   exception listener: java.io.EOFException
  java.io.EOFException
     at java.io.DataInputStream.readInt(DataInputStream.java:392)
     at org.apache.activemq.openwire.OpenWireFormat.unmarshal(OpenWireFormat.java:275)
     at   org.apache.activemq.transport.tcp.TcpTransport.readCommand(TcpTransport.java:221)
  at org.apache.activemq.transport.tcp.TcpTransport.doRun(TcpTransport.java:213)
  at org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:196)
  at java.lang.Thread.run(Thread.java:744) 
  </code></pre>
  
  <p>The problem is that I am not able to catch the exception, even when I tried to catch(Throwable) in the main method of the process. So, my question is: </p>
  
  <p>How I am supposed to catch these kind of problems in the listener so I can program something to recover from the error or at least terminate the process?</p>
  
  <p>Thanks!</p>