Hi , Here after 5 days i found a valid answer for limit the queue size in activemq.
Step 1: need to change the destination policy as bellow <destinationPolicy> <policyMap> <policyEntries> <policyEntry queue=">" producerFlowControl="true" memoryLimit="10 kb"/> <policyEntry queue=">" expireMessagesPeriod="1000"> </policyEntry> </policyEntries> </policyMap> </destinationPolicy> Step 2: once the publishing messages are exceeding the queue size it jvm will allocate the tempUsage to queue for restricting the temp size we use bello settings <systemUsage> <systemUsage sendFailIfNoSpace="true"> <tempUsage> <tempUsage limit="50 kb"/> </tempUsage> </systemUsage> </systemUsage> Step 3: restart your activemq, try to publish messages up to 10 kb memory limit if messages size exceeds the queue limit it will show the bellow exception in activemq log. javax.jms.ResourceAllocationException, which will propagate to the client. -- View this message in context: http://activemq.2283324.n4.nabble.com/Limit-the-activemq-queue-size-tp4702407.html Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.