How to create a priority queue with callback objects?


What would be the best method to create an autostarting queue that will take async jobs on the server by getting passed objects with callback functions? To clarify, One example of an item in the queue would be an array with [url, callback function] and then I would push the item on the array using fibers to return the result. Does this sound right?



(Haven’t tried this, but it was the first thing that came to mind)