对Azure的表的SqlDependency解决方案? [英] SQLDependency solution for Azure table?

查看:166
本文介绍了对Azure的表的SqlDependency解决方案?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要使用Azure的表来存储它是由用户提交的数据。每当用户帖子的东西也应该给到该用户通知其他用户。我特地与PokeIn彗星解决方案,以查看是否有它的一种方式。由于我是新来的这个技术,我想写code前需要了解的办法。

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.

我虽然到目前为止解决这个问题,你可以做反向Ajax调用到服务器。然后在服务器将连续检查数据库,以而循环,如果有什么改变。睡眠会被放在这样就不会超载。然而这会引入了很多不必要的检查,以数据库。我在这里刚才问的问题,如何做长轮询。而答案的一个建议使用的SqlDependency。然而,这是MS SQL具体。我想知道如何做到这一点在Azure中的表,如果它是可能的。

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.

任何意见或回答一般的做法是多AP preciated。

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

推荐答案

我回答根据您的问题,这个问题本质上公布第一段中如何使用Windows Azure的表(没有任何数据库)来写这样的解决方案(研究员SO专业人员可以具有不同的方法)。 Windows Azure的基本表是键值对数据库,所以没有这样的功能的SqlDependency。

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.

作为第一种方法,使用Windows Azure表和Windows Azure的队列,您可以创建这样的解决方案。当你写的东西Azure的表,你发布消息的Azure队列。在一个单独的线程可以保持检查队列状态,一旦有消息,你可以采取必要的行动。这种方法的缺点是,你需要不断地偷看队列,取决于你在你的投票是如何咄咄逼人,这会增加交易成本,但积极的检查(为0.001 $ 10,000)会迅速增加了不少。

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.

另一种解决方案是使用Windows Azure的表和服务总线。随着服务总线您无需使用轮询,而不是你可以开发在其中,当有更新你的表,你将收到通知,然后休息,你可以照顾的解决方案。

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.

我所看到的都是由用户实施的解决方案,并依赖于应用程序可用性的成本变化会如此不编码复杂度。选择的Windows Azure Queue或服务总线之前,我建议阅读下面的文章,了解两者之间的差异,以做出更好的决定:

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 Queue和的Windows Azure服务总线队列 - 比较和对比

这篇关于对Azure的表的SqlDependency解决方案?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆