I have a multi-tenant azure application where they may be many different jobs queued up. Each job consists of many individual tasks which are stored in a queue.
For both both user reasons, and technical reasons, a particular job should not consume too much of the work :
User : Don't want users to get stuck behind a huge job where they see no progress for a long time Technical : Processing the tasks involves hitting some limited resources on the network, where you can only have say 10 simultanious connections, but you may have thousands of tasks that will eventually need that connection.
To make it make it somewhat more complicated, some jobs are "related" in that they would consume the same resources, so the limit of 10 workers should be across those jobs
Currently we are using seperate queues for each job, which works ok, but we have to create them and clean them up on the fly, and have a queue of queues for the workers to find the appropriate queue
Also, this makes it difficult/impossible to do the related jobs.
Is there a good design pattern for this?