Alternatives to SQL Notification for triggering code on table changes
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 Notifica开发者_如何学JAVAtion 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?
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:
This release of the SQL Server 2005 Notification Services components provides support for running SQL Server 2005 Notification Services against either an instance of the SQL Server 2005 Database Engine or SQL Server 2008 Database Engine.
You can download the notes here: SQL 2005 SP 3 ReadMe files
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..
精彩评论