title: MessageConsumer.receive() doesn't remove message
body: <p>I am trying to write a test for a class used to send a JMS-message to ActiveMQ. What I am trying to accomplish is to get a method in the class under test to send the message to an ActiveMQ instance in localhost, and then pick the message up in the test and verify that it is correct. </p>
  
  <p>I have chosen this as my broker url: <code>vm://localhost?broker.persistent=true</code>, which means that a local ActiveMQ instance will be created, and the messages stored in a KahaDB (which is also created.) (I tried using <code>broker.persistent=false</code>, but since the method under test has a <code>finally</code>-clause that closes the connection, the in-memory messages are then lost before I can retrieve them.)</p>
  
  <p>In order to retrieve the message and verify it, I have the following code:</p>
  
  <pre><code>    //call method under test to send a message
      //create a ConnectionFactory with url vm://localhost?broker.persistent=true
      final Connection connection = connectionFactory.createConnection();
      connection.start();
  
      final Session session = connection.createSession(true, Session.AUTO_ACKNOWLEDGE);
      final Destination dest = session.createQueue("my.queue");
  
      final MessageConsumer messageConsumer = session.createConsumer(dest);
      Message message = messageConsumer.receive(1000);
  
      messageConsumer.close();
      session.close();
      connection.close();
  </code></pre>
  
  <p>My problem is that upon running this code, the messages are not being removed from KahaDb! Upon multiple test runs, the message added the first time will be read again and again. Am I missing something here, or is this a bug in KahaDB/ActiveMQ? I am using ActiveMQ 5.7.0.</p>