I'm not sure how best to describe this, or the best title, so bear with me!
I'm using MSMQ to queue up a large number of commands that will fire off HTTP requests to various websites and APIs. In order to avoid hammering these services (and to stay within certain pre-defined request limits) I need to ensure tasks hitting the same domain are executed only after a minimum time has elapsed from the last request.
Previously I was using a database to queue the tasks, and so could perform a query to achieve this, but we rapidly outgrew that solution with the number of tasks (way too many deadlocks on the table).
Does anyone have any suggestions as to what approach we could take? I've considered just keeping taking items off the queue until you find one that you can execute - but I'm conscious there's nothing to stop the ordering on the queue meaning we could take off thousands for the same domain before finding one on a different domain.
Thanks!