I have been a Core Server Side SQL Server DBA for more than half a decade. This was the first application side task that I handled from the SQL Server front. I would like to thank my friends Chakravarthy and Poornima for giving me this wonderful opportunity to work on Notification Services. I dont claim that this document would give you all that are needed to work with Notification Services. It just gives you a brief idea of what it is and how you can create a simple notification service application.
And before going into the discussion, let me say that Notification services is removed from SQL Server 2008 and though Microsoft Supports it in SQL 2005 it comes under the Support of Reporting Services feature and is not taken as an independent feature.
Microsoft Notification Services can be used to generate notifications and send it to the users. Notifications sent can be either event driven or scheduled. All subscribers who have subscribed for the subscription will be notified on the event.
Key Terms in Notification Services:
Instance Configuration File (ICF): This file contains parameter details for the Notification service instance. This is the primary file that is used to create the notification services.
Application Definition File (ACF): This File contains details of the application settings like the events, rules, subscribers, subscriptions, notification to be generated, etc.
Both of these files will be dealt in detail in the coming sections.
Subscriber: A person or application that subscribers to receive notifications.
Subscription: Its the information that needs to be sent to the subscribers.
Event: Its the piece of information that has to be captured and sent to the subscribers.
Notification: Notification is the message that contains the information related to the subscription.
Generator: It governs the rule processing for the notification services.
Distributor: It governs the notification formatting and delivery. It looks for notifications on a configured interval and sends the notifications to the subscribers in the event of an occurrence of the same.
Subscription Device: A subscription device can be anything like a e-mail, Phone, Message, File, etc
Notification Service Architecture:
Below is the simple architecture of how Notification service.
1. Subscribers subscribe to events.
2. Events are captured by the application.
3. Service matches subscriptions to the events.
4. Notification service generates a notification.
5. Notification Service formats and sends the notification to the subscribers.
Detailed Architecture of Notification Services.
1. Notification Services stores subscriber and subscription information on databases that are created for it. (A Notification service creates 2 databases when services are installed, we will be covering those in detail when we create the service). We can create a subscription management application using a programming language to manage subscriber and subscriptions. This provides the better subscription management for the subscriber (end users) to add/edit/view their subscription data.
2. Using the event providers that are defined in the Definition File, NS mines the database for events and stores the event data in the application database. There are various event providers that are available in NS. This event provider monitors a directory for XML event data. Using this event provider, you can drop XML event files in the directory, and the event provider reads the XML events and submits them to the application database. Another Advantage of Event providers is they can be run by the event provider host component, or they can run independently of Notification Services which gives it more robustness.
3. SQL Queries are written to get the necessary information passed to the notification services. Then generator matches the subscriptions and the events and generates notifications. According to the need of the application the administrator can configure how frequent this generator should run. This makes the application more efficient in time sensitive notifications.
4. The distributor distributes the notification after proper formatting using the content formatter described.
Creating a Sample Notification Service Application:
We are going to create a sample notification service application once you create the application you will find the following.
1. NS$instancename Services in the services applet.
2. InstanceNameApplicationName database in SQL Server.
3. InstanceNameNSMain database in SQL Server.
Steps to be followed:
1. Create an ICF file.
2. Create an ADF File.
3. Login to SQL Server management Studio, Right click Notification Services to create a new notification services instance.
4. Browse to the click ICF file and click OK
5. If it succeeds then you will see the above service and database created in the server.
6. Right click the Notification Service Instance Name, Goto Tasks->Register.
7. Check the Create Windows Service giving proper credentials and click OK.
8. Confirm this succeeds.
9. Right click Instance and select enable.
10. Right click Instance and select Start.
This starts SQL Server Notification Service and your notification service application starts to collect the events defined in the ADF file. I will cover how to use Notification Service to create and send notifications to subscribers in my next article on Notification Services.
Leave a Reply