0

I am using RabbitMQ with Clojure and Langohr, and I want to process messages off the queue in batches rather than one at a time. I could batch the messages myself after they're pulled off the queue, of course, but I'm curious if there's an API call or setting I'm missing that would get RMQ to deliver, say, 500 messages at a time to a consumer. Is this possible?

Logan Buckley
  • 211
  • 1
  • 4
  • 1
    Does `prefetch-count` from `basic.qos` fit your needs? – pinepain Mar 05 '15 at 17:35
  • If I understand correctly, prefetch-count causes RMQ to deliver a number of messages in sequence before receiving acks. The consumer would still have to group those messages and ack each of them individually, yes? It's a workable solution, but I was hoping there'd be a way for RMQ to not just deliver multiple messages to consumers, but deliver them in a batch (i.e., if I am using the pull-based approach, one get request would retrieve a batch of responses rather than a single response). – Logan Buckley Mar 05 '15 at 17:42
  • we experimented with creating a C# reactive rabbit consumer, I think you'd need to do something similar. – jhilden Mar 05 '15 at 19:29
  • Can you just group them together on producer side? – Vor Mar 06 '15 at 13:57
  • Grouping on the producer side might work, but I ended up just creating a consumer that put every incoming message on a new internal queue (I used a java.util.concurrent.LinkedBlockingQueue), then pulling in batches from that using a lazy sequence over it. – Logan Buckley Mar 07 '15 at 15:12

0 Answers0