[rabbitmq-discuss] RabbitMQ: Different consumer technique

Ajinkya Apte aapte at zynga.com
Mon Mar 10 17:15:30 GMT 2014


Yeh I thought about it a little more and just using the technique where the server pushes changes to the consumer makes most sense here. Thanks for the quick reply Jason.

AJ

From: Jason McIntosh <mcintoshj at gmail.com<mailto:mcintoshj at gmail.com>>
Reply-To: Discussions about RabbitMQ <rabbitmq-discuss at lists.rabbitmq.com<mailto:rabbitmq-discuss at lists.rabbitmq.com>>
Date: Monday, March 10, 2014 9:15 AM
To: Discussions about RabbitMQ <rabbitmq-discuss at lists.rabbitmq.com<mailto:rabbitmq-discuss at lists.rabbitmq.com>>
Subject: Re: [rabbitmq-discuss] RabbitMQ: Different consumer technique

Seems like a lot of heavy lifting for a consumer process.  If you use the alternative where rabbit pushes changes to your consumer (instead of basic_get), then rabbit will push new messages as they come in to your consumer, and the consumer will be idle otherwise using minimal resources.  For "basic.get_batch" - that's exactly what the prefetch count does on consumers - get 10 messages at once and process them.  Is there some particularly need to wrap it in all the extra layers?
Jason


On Mon, Mar 10, 2014 at 10:43 AM, Ajinkya Apte <aapte at zynga.com<mailto:aapte at zynga.com>> wrote:
(First time user of RabbitMQ)
Hey,
Technique:
Rather than writing a standalone PHP consumer script that keeps consuming the queue, I was planning on writing a batch get and quit PHP script. All that script does is get a batch of 10 from the queue, if the batch isn't available the script immediately exits. If available, it processes the batch and quits. I use a python script to make multiple calls to my 'Get Batch script' and make use of apache workers to do the work rather than making the php standalone script do the work.

Questions:
1. Firstly, do you see a reason why I should not think about consuming the queue this way?
2. (I am using the amq php lib) How can I do a batch get and exit if the batch is not present. With what I have learnt seems like I can set the qos to my batch count and use batch_consume for this. But if the batch is not available the script seems to wait till the batch is available. Is there a way I can timeout?
3. Do you have any usage recommendation for me?
4. Any plans of having basic.get_batch?

AJ

Sent from my iPhone

_______________________________________________
rabbitmq-discuss mailing list
rabbitmq-discuss at lists.rabbitmq.com<mailto:rabbitmq-discuss at lists.rabbitmq.com>
https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss



--
Jason McIntosh
https://github.com/jasonmcintosh/
573-424-7612
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20140310/46c69ccb/attachment.html>


More information about the rabbitmq-discuss mailing list