title: How to get all enqueued messages in ActiveMQ?
body: <p>I want to build a simple consumer program (in java) to get all messages stocked in an ActiveMQ subject.
  I have a producer which send TextMessage in the queue.</p>
  
  <p>But I don't know how to start to write my consumer for retrieving old messages and wait for new one.</p>
  
  <p>If you have an example, thanks!</p>
  
  <p>This is my Producer: <a href="http://pastebin.com/uRy9D8mY" rel="noreferrer">http://pastebin.com/uRy9D8mY</a></p>
  
  <p>This is my Consumer: <a href="http://pastebin.com/bZh4r66e" rel="noreferrer">http://pastebin.com/bZh4r66e</a></p>
  
  <p>When I run my producer before my consumer, then run the consumer, I got nothing.
  When I run my consumer then my producer, I add 72 messages in the queue but my consumer got only 24 message...</p>