1

I want to use Azure table to store data which is posted by users. And whenever a user post something to some other user it should give out a notification to this user. I have looked into Comet solution with PokeIn to see if there are a way for it. As I'm new to this technique I would like to know the approach before writing the code.

My though to tackle this problem so far is that you can make reverse ajax call to the server. And then at the server it will continuously check the database, with a while-loop, if something has changed. A sleep will be put so it won't overload the server. However this would introduce a lot of unnecessary checks to the database. I have asked a question here earlier, about how to do long polling. And one of the answer suggested to use SqlDependency. However this is MS SQL specific. I want to know how to do it in Azure tables, if it is possible.

Any comments or answer to the general approach would be much appreciated.

Community
  • 1
  • 1
starcorn
  • 8,261
  • 23
  • 83
  • 124

1 Answers1

3

I am answering this question based on your question essentially posted first paragraph in which how to use Windows Azure Tables (Without any Database) to write such solution (fellow SO professionals may have different approach). Windows Azure table essentially are key value pair database so there are no such functionality as SQLDependency.

As first approach, with Windows Azure Tables and Windows Azure Queues you can create such solution. When you write something to Azure Tables, you post a message to Azure Queue. In a separate thread you can keep checking for queue state and once there is a message you can take necessary action. The drawback to this approach is that you would need to constantly peeking the queue and depend on how aggressive you are in your polling, it will add transaction cost (about 10,000 for $0.001) but aggressive checking will adds up a lot quickly.

Another solution is to use Windows Azure Table and Service Bus. With Service bus you don't need to use poll instead you can develop a solution in which you will be notified when there is an update to your tables and then rest you can take care.

I have seen both the solution implemented by users and depend on application usability the cost varies so does coding complexity. Before choosing Windows Azure Queue or Service Bus, i would suggest reading the article below to understand the differences in between two to make better decision:

Windows Azure Queues and Windows Azure Service Bus Queues - Compared and Contrasted

AvkashChauhan
  • 20,495
  • 3
  • 34
  • 65
  • Thanks for the advice and information! I will read the article. – starcorn Jun 30 '12 at 18:07
  • My pleasure.. I love Totoro!! – AvkashChauhan Jun 30 '12 at 18:24
  • Hello again. I've been checking the solution using the service bus. One thing that I wonder about, I would need to use some Comet solution with it don't I? E.g Websync or PokeIn? – starcorn Jul 04 '12 at 20:09
  • I have used SqlSependency to trigger database changes to show push notifications to client but recently we moved to SQL Azure and it doesnt support `SqlSependency` so Is there a better way than [this](http://stackoverflow.com/questions/9880091/monitor-data-changes-in-sql-azure) to to get notifications when SQL Azure data changes or when new data is inserted ? – Shaiju T Jul 20 '16 at 16:10