I am using the QUEUE and the delivery mode is PERSISTENT. Somehow there are probably some messages in the queue, so that I kept receiving the messages were not produced currently. I found this link and plug the code provided by Tim, however I got the error. Would you please advise ?
http://stackoverflow.com/questions/16332205/clear-existing-messages-in-activemq-queue-just-after-starting-application-using error: cannot dynamic_cast '((Consumer*)this)->Consumer::connection' (of type 'class cms::Connection*') to type 'class activemq::core::ActiveMQConnection*' (target is not pointer or reference to complete type) -- View this message in context: http://activemq.2283324.n4.nabble.com/The-old-messages-produced-before-are-received-currently-need-to-purge-the-messages-tp4702021.html Sent from the ActiveMQ - User mailing list archive at Nabble.com.