title: ActiveMQ consumer execution delay
body: <p>I'm seeing a problem where a Queue is not backed up however the time for the consumer to actually execute the JMS message is between 100 - 200 seconds from creation (as measured via the JMSTimestamp-CurrentTime).  </p>
  
  <p>The flow was fairly low to the queue, less then 30 messages a minute.  I was able to resolve the issue by restarting ActiveMQ, after which messages were being started on less then 1ms from when they were created.</p>
  
  <p>I'm using ActiveMQ 5.4.1 and the normal total execution time for the work being done in the MDB is less then 2ms.  At the time of the delay, there were no error messages in the ActiveMQ log, CPU was low and had plenty of memory.</p>
  
  <p>It seems like the consumer is pulling the message off the queue, but sitting on them for some reason.  </p>
  
  <p>Is there some configuration issue which could be causing this issue?</p>
  
  <p>Edit:</p>
  
  <p>The first line of my MDB is as follows:</p>
  
  <pre><code> /* Check the time since this message was created versus processed */
          try {
              long secondsToProcess = TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis() - aMessage.getJMSTimestamp());
              if (secondsToProcess &gt; 5) {
                  log.error("JMS Consumer Start Delay: " + secondsToProcess + " s" + " JMS Message took more then 5 seconds to be processed");
              } else {
                  log.debug("JMS Consumer Start Delay: " + secondsToProcess + " s");
              }
          } catch (Exception e) {
              log.error(e);
          }
  </code></pre>