RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX


Get Started Using SQL Server 2005 Notification Services

Because of the complex configuration options required to write SQL Server 2005 Notification Services (SQLNS) applications, it can be difficult to get started, but after you've learned the concepts and ideas behind SQLNS, you'll find yourself able to write great applications that are both scalable and extensible using common interfaces.


eople receive many notifications daily: weather updates, news updates, updates about stock prices, or a current account balance via a SMS message. But how can you build such notification applications on the Microsoft platform? You have two options: the first and less palatable is to build everything from scratch. The second and more attractive option is to use the SQL Server 2005 Notification Services (SQLNS), which is a new API intended to help you build notification applications.

SQLNS—can generate and deliver notifications to thousands of end users of your application in several different ways and without any regard for the local time of the machine receiving the notification. One of the best known delivery protocols for notifications is e-mail, because people are used to working with emails constantly. But with SQLNS you can not only use e-mail notifications, but also provide notifications via SMS, pagers, or the Windows Messenger client. If none of those options seem palatable, you can also create your own delivery channel.

SQLNS is based on four components that form the heart of an SQLNS application. SQLNS applications are always hosted inside the SQL Server or inside a Windows Service. Table 1 describes these four main components.

Table 1. The table lists the four main components required for an SQLNS application and provides a description for each.
Component Description
Subscriber A subscriber is a person or an application who wants to receive notifications.
Subscription A subscription is a request for a notification and can be generated from an application through the SQLNS API. A typical example is the change of a stock price.
Event An event is an information, in which a subscriber is interested in. As soon as a stock price has changed an event can be generated that's processed within SQLNS.
Notification The notification component is a notification which is send to the registered subscriber through a defined delivery channel.

Figure 1. The core components of a SQLNS application.
Figure 1 shows how you combine these components in an SQLNS application.

SQLNS executes the following steps whenever it generates a new notification and sends it to registered subscribers:

  • Subscribers create subscriptions with a subscription management application, such as an ASP.NET or Windows Forms front end. Subscription management is the only part of an SQLNS application where users or applications are actively involved in the process. You generate subscriptions using a managed assembly shipped with SQLNS.
  • The Notification Application collects events, which are processed within the SQLNS application.
  • SQLNS uses T-SQL statements to assign events to the subscriptions registered in the first step.
  • SQLNS generates new notifications whenever it finds an assignment.
  • A Formatter formatsthe new notification, and SQLNS delivers it through a delivery channel to the registered target device of the subscriber.
As you can see from the preceding list of actions, SQLNS applications run completely within SQL Server except for the subscription registration process itself.

Close Icon
Thanks for your registration, follow us on our social networks to keep up-to-date