SpinGo / op-rabbit

The Opinionated RabbitMQ Library for Scala and Akka
Other
232 stars 73 forks source link

Question about QOS #53

Closed haggy closed 8 years ago

haggy commented 8 years ago

Hi there, I've been tracing the code and trying to see what qos does under the hood. The docs are a little sparse on the details (rightfully so). The reason I need to know is I am trying to create a wrapper for this which closely resembles another NodeJS based RMQ lib we use. What I want to know is what happens in Akka when I define a qos of lets say 10 (channel(qos = 10) {})? Details around that would be very helpful. Thanks in advance!

haggy commented 8 years ago

More context in case it helps; What I ultimately would like to do is have some kind of Round Robin load balancing across multiple RMQ instances. For example, if there are instances at 192.168.1.10 and 192.168.1.11, I want to be able to load balance across both equally (if I have 50 messages, I want 25 to go onto each RMQ instance). It doesn't look like I can do that out of the box so I am trying to dissect this and configure it appropriately.

timcharper commented 8 years ago

Hi @haggy , just reading your question now.

qos is purely a RabbitMQ server concern; op-rabbit passes it to the server and the server manages it.

https://www.rabbitmq.com/consumer-prefetch.html

Using the value to limit concurrent messages processed on an instance will help to support an even distribution of messages by time-to-process messages, but I'm not aware of a built-in mechanism which will provide even round-robin delivery. (there is a plugin that could help with it, though, which allows you to create a round-robin exchange that delivers messages evenly amongst bound queues).