用于在表更改上触发代码的 SQL 通知的替代方案
因此,我刚刚继承了一个应用程序,该应用程序使用与 SQL 通知服务关联的 SQL 依赖关系函数,以便在数据库中的一个表发生更改时执行某些功能。具体来说,我有一个 MVC 网站 - 在 global.asax 文件中,有一个监听函数,每当表发生更改时,该函数都会根据数据更改更新路由约束。
不幸的是,我们也迁移到了 SQL Server 2008。现在,我根本无法使用此功能。据我所知,它实际上已在 SQL Server 2008 中被删除,尽管令人烦恼的是,它有时似乎在出错时会触发。这让我有点困惑,但似乎该服务不再可用。
所以我需要一个建议的替代方案。我查看了 StreamInsight,但坦率地说,它似乎是一把大锤来破解坚果。另外,我非常怀疑对它的支持可能会被删除,就像对通知服务的支持一样。最简单的方法就是安排一个控制台应用程序每 5 分钟左右完成一次工作,但立即更新会更好,而且我不确定让命令行应用程序更新某些内容有多容易作为路由的网站基础。
那么 - 有什么建议吗?
So I've just inherited an application which used the SQL Dependency function associated with SQL Notification Services in order to perform some functionality whenever one of the tables in the DB was changed. Specifically I have an MVC website - in the global.asax file there was a listening function which updated the route constraints whenever a table was changed, based on the data changes.
Unfortunately we've also migrated to SQL Server 2008. Now, I can't get this functionality to work at all. As far as I can make out it has actually been removed in SQL Server 2008 although, annoyingly, it does sometimes seem to fire when it errors. Which confused me for a bit, but it would seem that the service is no longer available.
So I'm in need of a suggested alternative. I took a look at StreamInsight but it seems like a sledgehammer to crack a nut, frankly. Plus I'm more than a little suspicious that support for it might be removed going forward, just like support for Notification Services was. The simplest approach is simply to schedule a console application to do the work every 5 minutes or so, but immediate updates would be hugely preferable, and I'm not sure how easy it would be to get a command-line application to update something as fundamental on a website as the routing.
So - any suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
来自 此线程的 MS 帖子,SQL Server 2005 SP 3 通知服务将与 SQL Server 2008 一起运行。我不确定您是否要这样做,但据说只要支持 SQL Server 2005,就会支持这一点。
来自 SQL Server 2005 SP 3 通知服务的自述文件:
您可以在此处下载说明:SQL 2005 SP 3 自述文件
From an MS post on this thread, SQL Server 2005 SP 3 notification services will run with SQL Server 2008. I'm not sure if you want to do this, but supposedly this will be supported as long as SQL Server 2005 is supported.
From the readme for SQL Server 2005 SP 3 notification services:
You can download the notes here: SQL 2005 SP 3 ReadMe files
我认为您可以考虑使用一些 JMS 提供程序的发布订阅机制。您的 asp .net 页面可以将消息发布到订阅者将选择的主题并进行必要的更新。
I think you can consider publish subscribe mechanism using some JMS provider. Your asp .net page can post the message to a topic which will be picked up by a subscriber and do the necessary updates..