[rabbitmq-discuss] basic.getall?

Matthew Sackman matthew at lshift.net
Thu Nov 26 10:13:23 GMT 2009


On Thu, Nov 26, 2009 at 09:57:47AM +0000, Robert Raschke wrote:
> On Wed, Nov 25, 2009 at 9:04 PM, JD Conley <jdc at hive7.com> wrote:
> > What would be the best approach to get all of the messages in a queue with
> > as few calls as possible? Right now I'm doing a basic.get loop until the
> > queue is empty, but I think there is probably a better way.
> >
> Well, in my experience the fastest way to get messages is through
> subscribe/deliver. That can have your desired side-effect of keeping the
> queue clear if you can process the messages quickly enough.

Absolutely. Don't use basic.get. Instead subscribe to the queue with
basic.consume, and if you really want to avoid sending any responses to
the broker, set the noAck flag to true. That way you don't even have to
send acks back.

Matthew




More information about the rabbitmq-discuss mailing list