[rabbitmq-discuss] Limit QueueingConsumer Memory Usage

Lars George lars at worldlingo.com
Fri Jul 10 11:32:03 BST 2009


Hi,

I would like to use a blocking provider, but the QueueingConsumer is 
somewhat limiting as it receives whatever the queue sends and caches it 
locally, in the app servers memory. If that is a very large number then 
you can quickly run out of memory and kill the Java process with an OOME.

Is there a way to implement a Consumer that say only receives N queue 
items before it waits until they get processed locally? I mean from the 
internal BlockingQueue and using handleDelivery() this is doable but 
then you would block the main loop in the AMPQ connection - and miss 
heart beats etc.?

Is there a better way with this or do I have to go with a dumb while 
(true) { channel.basicGet() } loop. With that you have the issue to 
somehow gracefully handle the null delivery and not create a loop that 
consumes all CPU cycles with no actual work being done.

Thanks,
Lars
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lars.vcf
Type: text/x-vcard
Size: 313 bytes
Desc: not available
Url : http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20090710/5ad8572c/attachment.vcf 


More information about the rabbitmq-discuss mailing list