[rabbitmq-discuss] Good way to pause a consumer? (java)
Matthew Sackman
matthew at rabbitmq.com
Mon Mar 7 17:33:30 GMT 2011
On Mon, Mar 07, 2011 at 09:16:05AM -0800, Fox, Brian wrote:
> Is there a way to pause a consumer in the Java 2.3.1 client?
Yes, but that's not really what you want...
> The idea is to evenly consume messages from a queue using a distributed system of many consumers. As it stands, I think the consumer with the best network connection will consume the most messages, which is bad if that system is CPU bound.
>
> Any ideas on preventing this? I tried autoAck false without any apparent effect.
Use a lowish basic.qos value (e.g. 10 or less), then consume, and don't
set noAck (i.e. ack manually, after processing each message). That'll
ensure that messages are evenly distributed to consumers as they work
through their backlog, and no consumer gets flooded with work to do,
regardless of their network.
Matthew
More information about the rabbitmq-discuss
mailing list