(Windows Azure) Message Queues - Eventing over multiple machines
I am building an application in Windows Azure and require some advice for supplying events to multiple instances, that in turn push them to their respective event subscribers. I was thinking of using Message Queues (Azure Queue Storage).
To give some context, it's a Web application that uses a Comet implementation to push changes to clients. Due to scalability requirements it needs to function in a distributed environment. This implies that clients can be connected to different p开发者_运维百科hysical machines.
When a user makes a certain change this needs to be pushed to certain other users.
Using a message queue, all Role instances will have to peek at the message, but there is no way of knowing how many of the roles have looked at the message, so it's not obvious when to delete the queue. I could implement something in the line of counting the amount of roles and incrementing some counter everytime someone peeks. Is there some kind of default implementation for this, and am I going at it the right way?
I think that the Queue provided with the Azure AppFabric Service Bus would be a better fit for this scenario. The message queue feature is currently only CTP, so if you can live with that for a while until it is production ready, I would have a look at that. See http://vasters.com/clemensv/2011/05/16/Introducing+The+Windows+Azure+AppFabric+Service+Bus+May+2011+CTP.aspx
I would suggest not using Azure Queues for this, because they simply won't work well. In my opinion the proper way of doing this is using AppFabric queues.
I have written about them (a short introduction to AppFabric queues) on my blog and it also covers what I believe you need: Subscriptions. To give you some context, let's say we have two retail stores, a warehouse and an auditing application. We would create a Topic (for sales) and two subscriptions, one would be the warehouse application, and another would be the auditing application.
When a message lands in the queue, it's "copied" into both subscriptions. So your app instance really doesn't care if there are others wanting to read the message. If there are it's their responsibility to add a new subscription,
The final consideratiom for AppFabric is pricing, currently the pricing is connection based so for each opened connection to AppFabric you get charged a certain amount per month (the billing calculation is complicated as hell). However, I know for a fact they will be changing this to something much more understandable/logical, but have no more details than that.
In summary, look at AppFabric queues, they should provide the missing functionalities.
精彩评论