Posted on

A self queueing httpService component

I presented this at the Seattle Flex User Group Tuesday night, soon after finding that there are some methods used in this component that are unnecessary. I won’t go into it, but here’s what this is and why I created it.

This component is a canvas wrapping around an ArrayCollection of httpServices. There is another ArrayCollection used for the queue. Use the public call method to give it a url, the callback function and anything you might want attached to the AsyncToken like so:

var usefulNotes:String = “remember me!”;
myQ.call(“http://www.somedomain.com/service?arguments=foo”, myResultHandler, usefulNotes);

The target use case for something like this is not where you make one call and are done. I created this because I found a scenario where I would end up making hundreds of http calls at once. The browser won’t allow you to send them all at once so I wanted to track the progress of the calls. This allows you to add items to the queue and thus, see how many are waiting to be sent out.

It needs a lot of work so I welcome all feedback on this. If you improve upon it, please let me know. I’d love to see what this evolves into for others!

You can find the sample app here.(provide your own url – it’ll break without a valid one). It’s up mainly for the source code so you can play with it yourself. Enjoy!

Leave a Reply

Your email address will not be published. Required fields are marked *