← Back to team overview

txamqp-user team mailing list archive

Re: Automatic consume

 

On 03/02/2012 09:46, Aurélien Bompard wrote:
Hi all,

I'm considering the conversion of my applicative messenging system from
XMPP to AMQP, and since I'm currently using Twisted I'm evaluating txAMQP.
So far, it looks good, even if txAMQP is not as advanced as wokkel is
for the XMPP protocol (but maybe we can change that...)

I'm having a little problem though. I'd like to get my messages from the
rabbitmq server queue one by one, and unless I'm mistaken txAMQP can't
do that. Apparently, messages in the server queue are consumed as fast
as possible and put in a DeferredQueue object, from which I can get them
one by one via get().
However, I have a lot of messages going through my system, and I'd
rather have rabbitmq serve as the queue storage area than the client,
which has less RAM and performs relatively long-running operations (I
have many of them).

I have written a sample code to demonstrate what I'm talking about :
http://dpaste.com/hold/696982/
It starts a queue listener and prints the memory usage with guppy every
half second. It stops after 3 seconds.
Point it to a full server queue and see the memory usage increase.

Did I do something wrong ? If not, I'm ready to help with a solution,
but I'll need some help at the beginning.

Hi,

I think what you want is to set prefetch_count:

http://www.rabbitmq.com/amqp-0-9-1-reference.html#basic.qos.prefetch-count

This way, you'll only have one message at a time, and you can use ack to get the next message.

Regards,

--
Thomas


Follow ups

References