문제

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top