First look at Notification Services

Notification Services (NS) offers a framework for building alerting applications. The overall architecture sees event providers (File System Watcher, SQL statements, Analysis Services) that generate events. Subscribers (some UI or application) indicate that they want to receive noticifications when certain events are received. It’s the distributors that push the notifications through a protocol of your choice.

New in SQL Server 2005
SQL2005 gives the ability to use User defined rules and an Analysis Services Event Provider. It has a management API (NMO) instead of just T-SQL statements to get things going. You can put the database objects inside of your app database, not just a dedicated one. Also, you are allowed to host the execution engine where you want. It has 64-bit native and WoW (Windows on Windows) support. Finally, SQL2005 has NS integrated through SQL Server Management Studio (SSMS).

Using Notification Services
NS is organized into instances (not same as SQL instances) and applications. Instances identify the components of a NS deployment through an Instance Configuration File (ICF). Every instance can run multiple applications. These apps specify the database objects needed and the computers on which components execute. The definition file for apps is the Application Definition File (ADF). Both the ICF and ADF file are XML files.

It’s all about the events
The events are the things that happen and need to be notified to the subscribers. Events are just data modeled as rows in a view and they are submitted by the event providers. Not all events are passed to the subscribers. They need to match a rule for that to happen. The rule is a boolean combination of predicates. After a match the event is entered into a queue to be delivered.

Deploying NS applications
You need to create an NS instance by supplying the ICF file to either nscontrol.exe or SSMS. A database schema is created for you. Next, you must register the instance in the Service Control Manager (SCM) for NsService.exe. This will create a new Windows Service and a set of performance counters. If you host the generator (see architecture picture) inside of your own application, you can skip the registration step. Make sure you set the rights for the accounts that must access the database. The instance creation process will create a whole bunch of tables, views and sprocs inside of your database.

Some take-aways from the demo:

  • Inside of your ICF you can define parameters that while be prompted on creation. Throughout the ICF file you can use markers like %_NSServer_% to insert the values of the parameters in ASP style.
  • Chronicles allows you to keep history on events. E.g. say you subscribe to a stock ticker value and want to be notified if MSFT goes over 50. If events reach the generator for 50, 51, 52 and 54, you only want to have a single notification (for the first time it goes over 50) and not on all subsequent requests.
  • You have to write the ICF and ADF files by hand :0. No fancy UI. There are schemas for them, so adding IntelliSense is a breeze.

Advertisements
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s