I am making web-based system on Windows Azure, which process orders from different sources – web-site or web-services. First thing appeared in my head was using Azure message queue from web-site and web-service Roles to some worker Role which will actually process orders.
I have found few articles about messages driven architecture with Azure and they looked fine – we are getting message from the client, put it to the queue and respond user “OK, your action was processed” after that worked thread will read that message and do all magic. BUT here is an issue – if I want to send message’s processing result (order Id if it was success and fail reason if not) as a response to the client than I need to wait till the Worker Role will process it. The problem is that I did not find good/fast/cheap way to do that, as a possible way I can put message to the processing queue and check each X msecs if it was already processed or not (after processing, Worker will add information that message with Y Guid was processed together with results).
I don’t really like idea with such waiting because time for order processing can be from few seconds to few minutes and it will be additional load on the system if each client (up to 10-20 at the same time) will check each X msec if his request was processed or not (main reason). Also it will be pretty expensive in view of Azure Tables access rate(minor reason).
Can you advice some good way to implement that, please? I am looking for something like Event waiting in the desktop apps, which cannot be made with Azure in view of highly distribution.
What you are looking to do is have socket.io connections to the web server from the browser so you can respond instantly. There is a comet library for .NET, that I’ve never used, http://pokein.codeplex.com/. I’ve always done that part in Node.js, which is likely possible on Azure but might need some effort to get that running. Node has an awesome implementation for handling socket.io connections.
Web Request -> MQ -> Web Services -> Process Order -> Web Services on Web Server or MQ again -> Socket.io/comet -> web browser. All real time, as events happen.
If you let the use continue the browser the website, and just popped up a message that was like “you order has been processed, see the results here, when you are ready” the result is often pretty good.