you still need to tune the prefetch. the prefetch extension is used when a message is delivered but not acked, such that the broker and dispatch another message, the idea being that there will always be prefetch num messages pending. It also allows a transaction batch to exceed the prefetch value. So with prefetch=1, one message is dispatched, and when the broker gets a delivered ack, it used the prefetch extension to deliver another. With usePrefetchExtension false, it won't dispatch another message till the original is acked.
On 16 November 2012 06:04, himanshu_s83 <himanshu_...@yahoo.co.in> wrote: > Ok. Sure, will try that. So I assume that with usePrefetchExtension=false, > it > doesn't matter whats the prefetch size. Correct? > > With Prefetch Size 0 we initially saw messages getting consumed faster but > after a while, consumption rate became dead slow and queue size kept on > increasing to a very high value, even after increasing consumers. So we > reverted to earlier value of 1. > > We are using 5.0 version of ActiveMQ and consumers are created in a > threadpool with each consumer thread having a dedicated session. Our > threaded model is straightforward: > > while(1) { > consumer.receive() //threads block here for new message > processMessgae() //message get processed here > acknowledge() //message get acknowledged > } > > In addition to above, we are catching exceptions and calling > "session.recover()" appropriately. > > > > -- > View this message in context: > http://activemq.2283324.n4.nabble.com/jms-prefetchPolicy-queuePrefetch-1-means-2-outstanding-messages-tp4659398p4659431.html > Sent from the ActiveMQ - User mailing list archive at Nabble.com. > -- http://redhat.com http://blog.garytully.com