'RabbitMQ - fair distribution of (user related) task processing

We have a multi-user application which is working on tasks initiated by the users. These tasks are running asynchronously therefore we are using RabbitMQ technology for the task distribution.

In the first version of the program the tasks of every user are sent immediately to only one worker queue, so we faced the following problem, if "User A" sends his tasks quicker than "User B", then "User B" has to wait while the tasks of "User A" are all completed.

The next version of this program we want to give fair distribution so we introduced user related queues, so in the first phase the tasks of every user are sent to the user's own queue and we created a consumer which reads messages from all of the users queue and forwards these messages to the worker queue we used in the first version of the program. What we expected by this solution we could equally read messages from the users queue if we would limit the message size of the worker queue. But it is not working all of the user's tasks are immediately forwarded to the worker queue just like the message limitation of the worker does not exist.

I think it should work, but we missed some configuration... Thank you, if somebody could help us.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source