title: ActiveMQ - Memory limit reached for topic (Mirror Queue)
body: <p>We are using ActiveMQ 5.6 with the following configuration:
  - Flow control on
  - Memory limit for topics 1MB
  - Mirror Queues enabled (no explicit Virtual Topics defined)</p>
  
  <p>There are persistent messages being sent to a queue <code>QueueA</code>. Obviously, this message is copied to <code>Mirror.QueueA</code> which is a non persistent and automatically created topic.</p>
  
  <p>On this topic, there are no consumers. If there are consumers once in a while, they are non-durable subscribers.</p>
  
  <p>After a while, the producer blocks and we get the following error:</p>
  
  <pre><code>Usage Manager memory limit reached for topic://Mirror.QueueA
  </code></pre>
  
  <p>According to <a href="http://www.christianposta.com/blog/?p=265" rel="nofollow noreferrer">various sources</a> including the <a href="http://activemq.apache.org/how-does-a-queue-compare-to-a-topic.html" rel="nofollow noreferrer">ActiveMQ documentation</a>, there messages in a topic without durable subscribers will be dropped which is what I want and what had expected. But this is obviously not the case.</p>
  
  <p>There is <a href="https://stackoverflow.com/questions/5291679/activemq-topic-flooding">one related StackOverflow question</a> but the accepted solution suggests using flow control but disabling disk-spooling:</p>
  
  <blockquote>
    <p>That would not use the disk, and block producers when the memoryLimit is hit.</p>
  </blockquote>
  
  <p>But I do not want to block producers because they will block indefinitely because there is no consumer coming. Why are these messages are being persisted?</p>
  
  <p>I see few options:
  - This is a bug and probably fixed in later AMQ versions
  - This some configuration issue (of which I don't know how to resolve it)
  - There is some option to simply drop the oldest message when the memory limit is hit (I couldn't find any such option)</p>
  
  <p>I hope someone can help!</p>
  
  <p>Thanks,</p>
  
  <p>//J</p>
  
  <p><strong>[Update]</strong></p>
  
  <p>Although we have already deployed versions of 5.6 out in the field, I am currently running the same endurance/load test on a 5.8 installation of AMQ with the same configuration. Right now, I have already transmitted 10 times the messages as on the 5.6 system without any issues. I will let this test run over night or even the next days to see if there is some other limit.</p>