I'm interested in implementing the "Work Queues" model in RabbitMQ. However, I find that the broker does a simple round-robin based dispatching of tasks to workers.
https://www.rabbitmq.com/tutorials/tutorial-two-java.html
If a particular worker is busy doing a very heavy task and there are other free workers, the broker should be able to dispatch messages in queue to the next available worker and not the next worker in round-robin sequence. Is there a way to accomplish this using RabbitMQ?
Maybe you are looking for Fair dispatch (https://www.rabbitmq.com/tutorials/tutorial-two-java.html) based on QoS.
channel.basicQos(1);
Using a QoS(1) one consumer is busy until doesn’t send the ACK
,in this case another message is send to the next free consumer.
So if a consumer has a long process to do, it doesn’t receive messages.
If there are not a free consumers the messages remain to the queue.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With