Notification Services Tutorial The Notification Services tutorial teaches you how to build a simple Notification Services application

. The tutorial uses a SQL Server Management Studio solution to make it easy to edit tutorial files and then build the solution using SQL Server Management Studio Object Explorer. What You Will Learn In this tutorial, you will build a weather notification application. This application will let users subscribe to and receive weather notifications for individual cities. You will start with a minimal application definition file (ADF) and use a predefined instance configuration file (ICF) to create an instance of Notification Services that hosts the weather application. The information in the ICF and ADF is compiled and then used to create an instance database and an application database. The databases are used to store data and run the application. You will then update the ADF to describe the weather event, notification, and subscription data, and configure application execution settings. Every time that you update the application, you apply the changes to the application database. In the last two lessons of this tutorial, you will add subscriber and subscription data, and then add event data and view the resulting notifications. This is a simple application that does not use some of the more advanced features of Notification Services, such as digest or multicast delivery, custom event providers, custom content formatters, and custom delivery protocols. However, this tutorial does show the core steps for building a notification application that uses Notification Services. Requirements Before you start the tutorial, you should be familiar with Notification Services concepts and terminology. To learn about Notification Services, see Introducing SQL Server Notification Services. This tutorial is intended to be used on a single computer that has all the required software installed. Make sure that you have done the following:
• • •

You have installed the Database Engine, Notification Services, and Workstation Components. For more information, see Installing SQL Server 2005. You have installed the Notification Services samples. For more information, see Installing Samples. You have started an instance of the Database Engine. For more information, see Starting and Restarting Services.

Note: Before reviewing tutorials, you should add Next and Previous buttons to the document viewer toolbar. For more information, see Adding Next and Previous Buttons to Help. Contents This tutorial is divided into 11 lessons. You must complete all tutorial lessons in order to develop a working Notification Services application. Lesson 1: Opening and Examining the Tutorial Solution In this lesson, you open the SQL Server Management Studio solution and examine the files in the solution. Lesson 2: Performing an Initial Build of the Tutorial Instance In this lesson, you review the application definition file (ADF) for the Weather application and the instance configuration file (ICF) for the Tutorial instance of Notification Services, and then perform an initial build of the instance and application. Lesson 3: Adding an Event Class In this lesson, you add an event class to the ADF that describes event data. Lesson 4: Adding a Notification Class In this lesson, you add a notification class to the ADF that describes notification data, formatting, and delivery. Lesson 5: Adding a Subscription Class In this lesson, you add a subscription class to the ADF that describes subscription data and the rules that generate notifications. Lesson 6: Adding an Event Provider In this lesson, you add a non-hosted event provider declaration to the ADF. This is used to identify events added using the event submission stored procedures. Lesson 7: Configuring the Generator and Distributor In this lesson, you specify where the application's generator and distributor run, and the polling interval for the distributor. Lesson 8: Altering Application Execution Settings

In this lesson, you specify generator, distributor logging, and data removal settings. Lesson 9: Registering, Enabling, and Starting the Instance In this lesson, you register, enable, and start the instance of Notification Services. Lesson 10: Adding Subscribers and Subscriptions In this lesson, you add subscribers to the instance database and subscriptions to the application database. Lesson 11: Submitting Events to the Weather Application In this lesson, you add events to the application and then view the resulting notifications. Lesson 1: Opening and Examining the Tutorial Solution In this lesson you will open the SQL Server Management Studio solution for the tutorial and review the projects and files. You will also review Object Explorer as it pertains to this tutorial. After you complete this lesson, you should be familiar with the solution and ready to start working with the solution files. Opening the Tutorial Solution First, let's open the tutorial solution you will be working with. To open the tutorial solution 1. In Windows Explorer, locate the Notification Services Tutorial folder. The default location for this folder is C:\Program Files\Microsoft SQL Server0\Samples\Notification Services\tutorial. 2. Open the NSTutorial.ssmssln file. SQL Server Management Studio opens with solution files displayed in Solution Explorer. If Solution Explorer and Object Explorer do not appear, select them on the View menu. 3. Connect to the instance of the Database Engine where you want to store data for the instance of Notification Services. 1. In Object Explorer, click Connect and then select Database Engine. The Connect to Server dialog box appears. 2. In the Server name text box, select or enter the name of the Database Engine instance where you want to store Notification Services data for this tutorial.

Again. Typically. o AddSubscriptions. The Tutorial project contains files for the Tutorial instance of Notification Services. TutorialICF. The Miscellaneous folder contains four files: o WeatherADF. o WeatherTransform. This file contains XML code that describes the Weather application. • • The Queries folder contains Transact-SQL queries that you will later use to review database changes and submit events to the Weather application. you must enter a user name and password. but this script is a quick way to load subscriber and subscription data for prototyping. The Weather project contains files for the Weather application. Weather Project Next. Examining the Tutorial Solution In Solution Explorer.xml is an application definition file (ADF). script files like this are used primarily for prototyping.vbs is a VBScript file used to add subscriptions to the Weather application.xml. The Tutorial instance hosts the Weather application. select an authentication mode. you would build a subscription management interface using managed code. The Tutorial project contains only one file. examine the Weather project. you should see two projects: Tutorial and Weather. Object Explorer In Object Explorer.xslt is an Extensible Stylesheet Language Transformation (XSLT). This file describes the Tutorial instance of Notification Services. Click Connect. expand the Tutorial project and expand the Miscellaneous folder. o AddSubscribers. Tutorial Project First. This project contains files used to update and run the Weather application and to review database changes after performing some tutorial lessons. If you select SQL Server Authentication.vbs is a VBScript file used to add subscribers to the instance of Notification Services. The Notification Services folder is where you will be accessing Notification Services . 4. Most of the tutorial involves editing this file. In the Authentication text box. you will be using the Notification Services and Databases folders.3. The Weather application's XSLT content formatter uses the code in this file to transform raw notification data into formatted notifications.

review the application definition file (ADF). %_DBEngineInstance_%. To review the ICF 1. called Tutorial.xml. and can be overridden when you create or update the instance. Reviewing the ICF First.xml. 2. The Weather application uses two parameters: %_InstancePath_% and %_ServerName_%. The Databases folder will contain the TutorialNSMain instance and TutorialWeather application database. you will not be modifying TutorialICF. The Weather application will use the File . The value for this parameter is provided by the parameter defaults. In Solution Explorer. update. An Applications element that contains basic information about the Weather application. The element contains a parameter. update the ICF as needed. but you should know what the file contains. Double-click TutorialICF. Values for these parameters are provided by the parameter defaults. The instance configuration defines an instance of Notification Services. and start the instance of Notification Services. enable. During this tutorial. which is Tutorial. review the instance configuration in TutorialICF. Lesson 2: Performing an Initial Build of the Tutorial Instance Updated: 17 July 2006 In this lesson you will review the instance configuration file (ICF). folder. register. A SqlServerSystem element that specifies the instance of SQL Server that will host the Notification Services databases. and then expand Miscellaneous. expand Tutorial. This includes the application name. and can be overridden when you create or update the instance. that hosts the Weather application. and then create the Tutorial instance of Notification Services. A DeliveryChannels element that defines a delivery channel for the builtin File delivery protocol. The ICF contains the following elements: o o o o o A ParameterDefaults element that contains default values for ICF and ADF parameters. and the names and values of any replaceable parameters in the ADF. An InstanceName element that specifies the Notification Services instance name.dialogs to create.xml. ADF location.

2. This includes an empty SubscriptionClasses element. Double-click WeatherADF. which is typically C:\Program Files. You will be modifying this file during the tutorial. The value for _InstancePath_ is the path to the TutorialICF. %ProgramFiles% is an environment variable that gets the path of the Program Files folder on the local computer. %_NSServer_%. replace %COMPUTERNAME% with the SQL Server instance name. verify that the following values in the ParameterDefaults section of the ICF are correct: • • • The value for the _DBEngineInstance_ parameter must be the name of the Database Engine instance you are connected to in Object Explorer. and specifies where the Notification Services engine components will run.htm. Reviewing the ADF Next. The value for the _ServerName_ parameter should be the name of the local computer. These notifications will be written to a file named FileNotifications. which is not recommended for this tutorial. expand Weather and then expand Miscellaneous.The value for this parameter is provided when you create the instance of Notification Services and is passed from the ICF to the ADF. In Solution Explorer.xml. update this value with the correct path of the tutorial files. The initial ADF is almost empty. save and close TutorialICF. which is an environment variable that gets the name of the local computer. an empty NotificationClasses element. Editing the ICF ParameterDefaults To make updating the tutorial easier. Unless you are scaling-out the instance. the value should be the same as the computer name. These elements contain a parameter.xml. To review the ADF 1. It contains only those elements required for the application to build successfully.delivery protocol to deliver notifications to the delivery channel named FileChannel. If you are connected to a named instance. . This value is passed to the ADF. If you did not install the samples to the default location. For the default instance.xml. review the initial application definition in WeatherADF. and the SystemName elements for the application's generator and distributor. you should leave the value as %COMPUTERNAME%.xml file. If you have changed any values in the ParameterDefaults section. The default value for this parameter is %COMPUTERNAME%.

locate the TutorialICF. A dialog shows the status of the create actions. If you are using the %COMPUTERNAME% and %ProgramFiles% environment variables. . If you do not see these databases. and then click Open. you provide Notification Services with the name of the ICF and values for any parameters needed by the ICF.xml file. review the values for the parameters. In the Parameters grid. which is the instance database. You will use SQL Server Management Studio to create the instance of Notification Services. too. and then try to create the instance of Notification Services again. Notification Services uses the ICF to create an instance database and uses the Weather application's ADF that is referenced in the ICF to create an application database. 2. If the actions do not complete successfully. In Object Explorer.Create the Instance of Notification Services When you create an instance of Notification Services. The default location for this file is C:\Program Files\Microsoft SQL Server0\Samples\Notification Services\tutorial\TutorialICF. To review the results 1. In Object Explorer. 4. When the create actions complete. You should see two databases: TutorialNSMain. click Close. Click OK. Review the Results After you create the Tutorial instance. These should be the values you provided if you edited the ICF. right-click Notification Services and select New Notification Services Instance. expand Databases. right-click Databases and select Refresh. Click Browse. which is the application database. and TutorialWeather. To create the instance of Notification Services 1. 5. All actions should complete successfully. Notification Services shows the values for these variables.xml. you should see two new databases and an instance of Notification Services in Object Explorer. 3. verify that the parameter values you provided are correct.

collecting. data types. For each event field. Add the Event Class XML to the ADF The XML in this section defines the event class. You can learn more about event classes by reading Defining Event Classes. you define a type of event that can be submitted to your application and used to generate notifications. such as indexes on the event data and supplemental tables. right-click Notification Services and select Refresh. You should see an instance of Notification Services named Tutorial. When you create the application. The event class definition includes the event field names. To add the event class XML to the ADF 1.2. An event class can define other information. Click Copy Code to copy the XML to the Windows Clipboard. the event class also specifies an index on the City field of the WeatherData event class. Date. The WeatherData Event Class For this application. To improve performance for notification generation. and type modifiers. Examine the XML and then follow the instructions to copy the XML to the ADF. the event class defines the field name. Event Class Primer An event class represents one type of event used by your Notification Services application. You can then review the changes made to the application database. When you define an event class. City. Lesson 3: Adding an Event Class In this lesson you will add an event class to the application definition file (ADF) and then update the instance of Notification Services to apply the changes to the application database. views. XML . and field modifiers. If you do not see the Tutorial instance. Notification Services uses the event class definition to create tables. These describe the event data you will later submit to the application. and Forecast. and managing event data. Low. Expand Notification Services. indexes. data type. you will add a WeatherData event class to the ADF. High. and stored procedures for storing. This event class has five event fields.

Event Classes --> <EventClasses> <EventClass> <EventClassName>WeatherData</EventClassName> <Schema> <Field> <FieldName>City</FieldName> <FieldType>nvarchar(35)</FieldType> <FieldTypeMods>not null</FieldTypeMods> </Field> <Field> <FieldName>Date</FieldName> <FieldType>datetime</FieldType> <FieldTypeMods>not null</FieldTypeMods> </Field> <Field> <FieldName>Low</FieldName> <FieldType>float</FieldType> <FieldTypeMods>not null</FieldTypeMods> </Field> <Field> <FieldName>High</FieldName> <FieldType>float</FieldType> <FieldTypeMods>not null</FieldTypeMods> </Field> <Field> <FieldName>Forecast</FieldName> <FieldType>nvarchar(3500)</FieldType> <FieldTypeMods>not null</FieldTypeMods> </Field> </Schema> <IndexSqlSchema> <SqlStatement>CREATE INDEX myIndex ON WeatherData ( City ). . In Solution Explorer.xml. Replace the following comment with the XML you just copied. select Save WeatherADF. </SqlStatement> </IndexSqlSchema> </EventClass> </EventClasses> 2. On the File menu. Update the Instance of Notification Services After you modify the ADF. you update the instance of Notification Services to add event class objects to the application database. open WeatherADF. <!-. 3.xml.Copy <!-.Replace with EventClasses XML --> 4.

When you later write notification generation queries. In the Parameters grid. or the API. you must use one of the supported event submission methods. Review the Notification Services . point to Tasks. return to Lesson 2 to learn how to edit parameter defaults in the ICF. 6. review the values for the parameters.xml file. Notification Class Primer . views. you select data from this view. The values should be correct because you modified them as needed in Lesson 2. you will add a notification class to the application definition file (ADF) and then update the instance of Notification Services to apply the changes to the application database. and then click Update. In Object Explorer. You can use Object Explorer to examine these objects in the TutorialWeather database. 5.NSWeatherDataEvents table is the underlying table that contains event data for the event class. click Close. Lesson 4: Adding a Notification Class In this lesson. • • The dbo. such as the built-in event providers. The dbo. Notification Services adds tables. and then select Update. 2. locate and select the TutorialICF. Click OK. For more information. 4. You can then review the changes made to the application database. expand Notification Services. see Defining Event Providers. Caution: Do not directly modify data in the application and instance databases.WeatherData event view is the current set of events being processed by the application.To update the instance of Notification Services 1. You may have to refresh Object Explorer to see the new objects. event submission stored procedures. Event data stays in this table until it is removed by the vacuumer data removal process. click Browse. Right-click Tutorial. and stored procedures for the event class in the TutorialWeather application database.Update Summary dialog box. 7. and then click Open. If you must edit these values. To add event data. Review the Changes in the Application Database When you update the instance. 3. In the Update Instance dialog box. When the update actions are complete.

indexes. including the data types. The XSLT file name is WeatherTransform. For more information about the XSLT content formatter. views. Information about how delivery protocols are to be used to deliver notifications. In this application. Notification Services uses the notification class definition to create tables. and SubscriberLocale. you define the following information: • • • Fields for the notification data. After formatting. When you create the notification table and view. Notification Services will deliver the notifications to a file by using the built-in File delivery protocol. This notification class has five notification fields. it will format the raw data into a customized message using the built-in XSLT content formatter. You can use the built-in Extensible Stylesheet Language Transformations (XSLT) content formatter. but this is not required. see XSLT Content Formatter. the value for this parameter is provided in the ICF. failure. and a File delivery protocol. and time-out settings. These fields define the data you will be sending to subscribers. When Notification Services distributes the notifications. DeviceName. The file name and location are defined in the DeliveryChannels element of the ICF. and protocol execution settings to configure retry. and stored procedures for storing and managing notification data. see Defining Notification Classes. High. Low. Protocol definitions can contain field definitions for message headers. . the notification class fields match the event class fields. • • • The notification fields are City.xslt. These fields are required by Notification Services. Date. When you create or update the application. When you define a notification class. You can also define optional settings such as digest or multicast delivery and the notification expiration age. and Forecast. or you can use a custom content formatter. but most other protocols use header fields. Information about the content formatter used to format notifications for the notification class. Notification Services adds the following fields: SubscriberId. an XSLT content formatter. you will add a WeatherAlerts notification class to the ADF. The File protocol does not use these settings. and are described in later lessons. For more information about notification classes.A notification class represents one type of notification produced by your Notification Services application. and the file location is defined by the %_AppPath_% parameter. such as those required by SMTP. The WeatherAlerts Notification Class For this application.

XML Copy <!-. Examine the XML and then follow the instructions to copy the XML to the ADF.Notification Classes --> <NotificationClasses> <NotificationClass> <NotificationClassName> WeatherAlerts</NotificationClassName> <Schema> <Fields> <Field> <FieldName>City</FieldName> <FieldType>nvarchar(35)</FieldType> </Field> <Field> <FieldName>Date</FieldName> <FieldType>datetime</FieldType> </Field> <Field> <FieldName>Low</FieldName> <FieldType>float</FieldType> </Field> <Field> <FieldName>High</FieldName> <FieldType>float</FieldType> </Field> <Field> <FieldName>Forecast</FieldName> <FieldType>nvarchar(3500)</FieldType> </Field> </Fields> </Schema> <ContentFormatter> <ClassName>XsltFormatter</ClassName> <Arguments> <Argument> <Name>XsltBaseDirectoryPath</Name> <Value>%_AppPath_%</Value> </Argument> <Argument> <Name>XsltFileName</Name> . Click Copy Code to copy the XML to the Windows Clipboard. Add the Notification Class XML to the ADF 1. Add the Notification Class XML to the ADF The XML in this section defines the notification class.Note: The File delivery protocol is intended primarily for prototyping and testing.

and stored procedures for the notification class in the TutorialWeather application database. expand Notification Services.Notification Classes --> <NotificationClasses></NotificationClasses> 4. In Object Explorer.<Value>WeatherTransform. Click OK. Review the Notification Services . you update the instance of Notification Services to add notification class objects to the application database: To update the instance of Notification Services 1. click Browse. Right-click Tutorial. Replace the following XML with the XML you just copied. 5. 7. select Save WeatherADF.xml file. • The dbo. click Close.Update Summary dialog box. 2.xslt</Value> </Argument> </Arguments> </ContentFormatter> <Protocols> <Protocol> <ProtocolName>File</ProtocolName> </Protocol> </Protocols> </NotificationClass> </NotificationClasses> 2. On the File menu.WeatherAlerts view is where the notification generation rules will insert notifications. . In the Parameters grid. and then click Update. views. point to Tasks. Notification Services adds tables.xml. Update the Instance of Notification Services After you modify the ADF. review the values for the parameters. open WeatherADF. In Solution Explorer. locate the TutorialICF.xml. 4. When the update actions are complete. 6. and then click Open. In the Update Instance dialog box. 3. 3. and then select Update. Review the Database Changes When you update the instance. Use the same values you used to create the instance. <!-.

Then. When defining storage for subscription data. These fields let you customize notifications for different devices.NSWeatherAlertsFileNotifications view contains notifications from the WeatherAlerts notification class sent using the File delivery protocol.NSWeatherAlertsNotificationDistribution view combines data from several internal Notification Services tables to provide information about notification distribution attempts. you provide an interface to let subscribers create subscriptions in which they specify a city. if part of the subscription data is a city of interest.• • • The dbo. The dbo. This view is for internal use only. The dbo. Notification Services adds a SubscriberId field to the underlying table for each subscription class. you must also define a notification generation rule. Tables and views for internal use only contain data that is used for internal operations. This table is for internal use only. Lesson 5: Adding a Subscription Class In this lesson. You can then review the changes made to the application database. Notification data stays in this table until it is removed by the vacuumer data removal process. and languages. Subscription Class Primer When you define a subscription class. You may have to refresh Object Explorer to see the new objects. Caution: Do not directly modify data in the notification tables and views. you define fields for the subscription data you collect. you are defining storage for subscription data and queries that generate notifications from event and subscription data. If your application supports multiple subscriber locales and multiple devices. Besides defining subscription fields. You can use Object Explorer to examine these objects in the TutorialWeather database. For example. you also can add DeviceName and SubscriberLocale fields to the subscription fields. time zones. you will add a subscription class to the application definition file (ADF) and then update the instance of Notification Services to apply the changes to the application database. you can add a City subscription field.NSWeatherAlertsNotifications table is the underlying table that contains notification data for the notification class. such as email and cellular phones. This rule is a Transact-SQL query that matches event and subscription data and inserts . you do not have to understand this data.

indexes. High. DeviceName. Event-driven rules run whenever events arrive. s.Forecast FROM WeatherData e.SubscriberLocale. you will add a WeatherCity subscription class to the ADF. Low. When you create the application. you can join the event and subscription views and insert data into the notification view: XML Copy INSERT INTO WeatherAlerts(SubscriberId. This subscription class also defines a notification generation query. City. the WeatherAlerts notification class has the same fields as the event class (City. such as indexes on the subscription data and supplemental tables.City = s. A subscription class can define other information. DeviceName. Date.Low. As shown in Lesson 4. Also. e. The subscription class has a City field.City. Notification Services uses the subscription class definition to create tables. To write this query. and Forecast). This subscription class has three fields. These fields become columns in views. e. For more information about subscription classes. what notification data you want to produce. The DeviceName and SubscriberLocale subscription fields are defined so that you can add support for multiple devices and locales. e. s. Forecast) SELECT s. WeatherCity s WHERE e. When subscribers create weather subscriptions. The City field is the important field for this application. the WeatherData event class has five fields: City. and what subscription data is available: • • • • As shown in Lesson 3.the results into the notification class view. These rules can be event driven or scheduled. Date.City. you must know what event data is available. views. SubscriberLocale. Knowing these fields.High.SubscriberId. The WeatherCity Subscription Class For this application. and Forecast. and City. SubscriberLocale. and SubscriberLocale. High. Scheduled rules evaluate individual subscriptions on a schedule provided in the subscription. Low. Date. High. remember that the underlying notification table has the following fields: SubscriberId.DeviceName. and stored procedures for the subscription class.Date. e. . DeviceName. they must specify the name of a city. e. see Defining Subscription Classes. Low.

e.City.DeviceName. e. Examine the XML and then follow the instructions to copy the XML to the ADF. Low. s. Notification Services then inserts the results into the notification view. it joins the current set of events in the event class view with the subscriptions in the subscription class view based on matches between the event and subscription City values. SubscriberLocale. DeviceName.High. City. s.City = s. e.Subscription Classes --> <SubscriptionClasses> <SubscriptionClass> <SubscriptionClassName>WeatherCity</SubscriptionClassName> <Schema> <Field> <FieldName>DeviceName</FieldName> <FieldType>nvarchar(255)</FieldType> <FieldTypeMods>not null</FieldTypeMods> </Field> <Field> <FieldName>SubscriberLocale</FieldName> <FieldType>nvarchar(10)</FieldType> <FieldTypeMods>not null</FieldTypeMods> </Field> <Field> <FieldName>City</FieldName> <FieldType>nvarchar(40)</FieldType> <FieldTypeMods>not null</FieldTypeMods> </Field> </Schema> <EventRules> <EventRule> <RuleName>WeatherEventRule</RuleName> <EventClassName>WeatherData</EventClassName> <Action> INSERT INTO WeatherAlerts(SubscriberId.SubscriberLocale. WeatherCity s WHERE e.When Notification Services runs this query.Low.Forecast FROM WeatherData e. Add the Subscription Class to the ADF The XML in this section defines the subscription class. Forecast) SELECT s. </Action> . Click Copy Code to copy the XML to the Windows Clipboard. e. e.SubscriberId. High. XML Copy <!-.City. Date. To add the subscription class to the ADF 1.Date.

click Close.Update Summary dialog box. 7. When the update actions complete.xml file.</EventRule> </EventRules> </SubscriptionClass> </SubscriptionClasses> 2. The dbo. 2. open WeatherADF. The dbo. Update the Instance of Notification Services After you modify the ADF. In your notification generation query. Notification Services adds tables. 5. locate the TutorialICF. Use the . review the parameter values. To update the instance of Notification Services 1. point to Tasks.WeatherCity view contains the current set of subscriptions being evaluated by the application.WeatherCityView view provides a view of the subscription records for the associated subscription class. In the Parameters pane.Subscription Classes --> <SubscriptionClasses></SubscriptionClasses> 4. expand Notification Services. you update the instance of Notification Services to add subscription class objects to the application database. Review the Changes in the Application Database When you update the instance. and then click Open. Click OK. 3. 6. Caution: Do not directly modify the data in the subscription tables and views. select Save WeatherADF. Replace the following XML with the code you just copied. In the Update Instance dialog box. In Object Explorer. 4. Review the Notification Services .xml. In Solution Explorer. and stored procedures for the subscription class in the TutorialWeather application database: • • • The dbo. On the File menu.xml. <!-.NSWeatherCitySubscriptions table is the underlying table that contains subscription data for the subscription class. views. you select subscription data from this view. and then select Update. click Browse. 3. Right-click Tutorial. and then click Update.

Lesson 6: Adding an Event Provider In this lesson. You may have to refresh Object Explorer to see the new objects. When an event provider submits a set of events. see Defining Event Providers. If the standard event providers do not meet the needs of your application. the SQL Server event provider. or they can be nonhosted. Event Provider Primer Event providers collect event data and submit it to Notification Services. you will configure a non-hosted event provider that you will later use when you submit events to the Weather application. Using these event providers. The set of events. You can use Object Explorer to examine these objects in the TutorialWeather database. For more information. Non-hosted event providers are stand-alone applications that submit events to a notification application without being hosted by the Notification Services engine. you can easily gather events from an XML file. To help you develop and deploy a Notification Services application quickly.subscription management objects. it submits the events to an event class view. you give the non-hosted event provider a name in the ADF. Notification Services includes three standard hosted event providers. You will then update the instance of Notification Services to apply the changes to the application database. The WeatherSPEventProvider Event Provider . and the Analysis Services event provider. and gather events using an MDX query. see Developing Subscription Management Interfaces. called an event batch. you can develop event providers that are customized to your environment and event sources. This name is used for tracking and troubleshooting event collection. is inserted into the event class view. For more information. gather events using a TransactSQL query. Tables and views for internal use only contain data used for internal tracking and data lookup. When you define a non-hosted event provider. The Notification Services engine can host your custom event providers. This means that the Notification Services engine starts and runs hosted event providers. The Notification Services engine hosts all these event providers. You can use the standard event providers in your application by specifying predefined names and custom operational parameters in the application definition. Each event then becomes a row in the underlying event class table. a file system watcher.

you will just provide a name for this event provider so that you can later determine which events it submitted to the application. In Solution Explorer. 3. XML Copy <!-. In Object Explorer. The name of the event provider will be WeatherSPEventProvider. and then click Open. As mentioned earlier.xml.xml. and then select Update. click Browse. Right-click Tutorial.For this application. Replace the following comment with the XML you just copied.Event Providers --> <Providers> <NonHostedProvider> <ProviderName>WeatherSPEventProvider</ProviderName> </NonHostedProvider> </Providers> 2. and you will use the name WeatherSPEventProvider when submitting those events. you update the instance of Notification Services to add the event provider definition to the application database. In the Update Instance dialog box. To add the provider code to the ADF 1. <!-. On the File menu. Update the Instance of Notification Services After you modify the ADF. you will add a non-hosted event provider to the ADF.xml file. . You will later use stored procedures to submit events to the Weather application. To update the instance of Notification Services 1. locate the TutorialICF. point to Tasks. Examine the XML and then follow the instructions to copy the XML to the ADF. select Save WeatherADF. open WeatherADF. Add the Provider Code to the ADF The XML in this section defines the non-hosted event provider. 2.Replace with Providers XML --> 4. expand Notification Services. Click Copy Code to copy the XML to the Windows Clipboard. 3.

If a work item is available. click Close. called a distributor quantum. called a work item. You may have to connect to the instance of the Database Engine. the distributor acquires the work item. . and then click Update.sql. and then expand Queries. Review the Changes in the Application Database When you update the instance. calls the content formatter to transform the notification data. To view TutorialWeather event providers 1. which are also run by the Notification Services engine. On a configurable interval. 6. In the Parameters grid. 3. to process. 2. Press F5 to run the Transact-SQL query. Use the same values you used to create the instance. Review the Notification Services . Lesson 7: Configuring the Generator and Distributor Updated: 5 December 2005 In this lesson. Distributors. Settings for the generator determine which computer runs the generator and how many threads the generator can use when it processes application rules. see Specifying Generator Settings. you will review generator and distributor settings in the application definition file (ADF) and then modify and update the distributor settings.4. Double-click ViewEventProviders. In Solution Explorer. the distributor looks for a group of notifications. and then sends the formatted notifications using a delivery protocol. Notification Services adds information about the event provider to the NSProviders table in the TutorialWeather application database. Each application has one generator. When the update actions complete. 7. For more information about generators. Click OK. 5. expand Weather.Update Summary dialog box. govern notification formatting and delivery. Generator and Distributor Primer The generator that is run by the Notification Services engine governs the rule processing for a notification application. review the values for the parameters.

see Specifying Distributor Settings. To modify the distributor ADF code 1. open WeatherADF. Click Copy Code to copy the XML to the Windows Clipboard. Weather Application Generators and Distributors For purposes of this application. In Solution Explorer.Paste QuantumDuration here --> Notice that the only line of code you are adding is the distributor's QuantumDuration element and value. the generator and distributor will run on the local computer. In this lesson. XML Copy <QuantumDuration>PT15S</QuantumDuration> 2. you will simply add a polling interval for the distributor. On the File menu.Each application can have one or more distributors. you can just add that line of XML to the ADF. If you prefer. click Save WeatherADF. 4. You provide a value for this parameter through the instance configuration file (ICF) when you create or update the instance. Examine the XML and then follow the instructions to copy the XML to the ADF. the polling interval defines how frequently the distributor looks for work items. . For more information about distributors.xml. Copy <!-. Modify the Distributor ADF Code The XML in this section defines the distributor for the Weather application. Notice that the system name value for the generator and the distributor in the XML is %_NSServer_%.xml. with a maximum of one distributor per application per computer. 3. This interval will be 15 seconds. Replace the following XML comment with the XML you just copied. and you will use the default thread pool settings. This is PT15S in the XML duration format.

These settings control how frequently data is processed. . distributor logging. 6. 7. In the Parameters pane. Right-click Tutorial. • You will set the quantum duration to 15 seconds. For more information about these settings. 2. and how frequently old data is removed from the database. point to Tasks. expand Notification Services. You should configure these settings in every application. how events are processed. 3. locate the TutorialICF. For more information. click Close. Use the same values you used to create the instance. see Specifying the Generator Quantum Duration. review the values for the parameters. and then click Update. this quantum duration might be longer. Application Execution Settings for the Weather Application For this application. In Object Explorer. Click OK. how far the generator is allowed to fall behind the real-time clock. and then click Update. you update the instance of Notification Services to modify distributor settings in the application database. To update the instance of Notification Services 1. This is PT15S in the XML duration format.Update the Instance of Notification Services After you modify the ADF. In the Update Instance dialog box. see Specifying Application Execution Settings. Review the Notification Services . Lesson 8: Altering Application Execution Settings In this lesson you will configure application execution settings in the application definition file (ADF) and then update the instance of Notification Services to apply the changes to the application database. This configures the generator to fire subscription rules every 15 seconds.Update Summary dialog box. you will configure three application execution settings: the generator quantum. 5. and the data removal interval. When the update is completed.xml file. how distribution data is logged. Application Execution Settings Notification Services provides several application execution settings for tuning your application. In your applications. and then click Open. how much data can be received and sent. click Browse. 4.

Replace the following comment with the code you just copied. but you should turn off all or most distributor logging when you deploy your applications.ApplicationExecutionSettings --> <ApplicationExecutionSettings> <QuantumDuration>PT15S</QuantumDuration> <DistributorLogging> <LogBeforeDeliveryAttempts>false</LogBeforeDeliveryAttempts> <LogStatusInfo>false</LogStatusInfo> <LogNotificationText>false</LogNotificationText> </DistributorLogging> <Vacuum> <RetentionAge>P1D</RetentionAge> <VacuumSchedule> <Schedule> <StartTime>23:00:00</StartTime> <Duration>P0DT02H00M00S</Duration> </Schedule> </VacuumSchedule> </Vacuum> </ApplicationExecutionSettings> 2.• • You will turn off distributor logging to minimize the data logged to the application database per notification. You may want to enable distributor logging during application development. For more information. <!-. The vacuuming schedule specifies that data older than one day can be deleted from the database. Click Copy Code to copy the code to the Windows Clipboard. . and distribution data is regularly removed from the application database. On the File menu.xml. click Save WeatherADF. In Solution Explorer. and that the data removal process runs at 23:00:00 UTC.xml. To add the application execution settings code to the ADF 1. For more information. 3. notification. Examine the XML and then follow the instructions to copy the XML to the ADF. open WeatherADF. You will specify a data removal interval so that older event. see Configuring Data Removal.Replace with ApplicationExecutionSettings XML --> 4. Add the Application Execution Settings Code to the ADF The XML in this section configures application execution settings as described earlier. see Configuring Distributor Logging. XML Copy <!-.

and then click Open. 3. you will enable and start the instance. The Notification Services engine is either a Windows service that you create when you register the instance on a computer. expand Notification Services. These components are run by the Notification Services engine. which is the computer where that component runs. If the application had used a hosted event provider.xml. Then. In the Parameters pane. Use the same values you used to create the instance. and distributors in the application definition file (ADF).Update Summary dialog box. When you configure hosted event providers.xml file. you will configure security for the instance of Notification Services and register the instance of Notification Services that installs the Notification Services engine. it connects to the instance and application databases to determine what components it runs and if those components are enabled. 2. 8. you specify a system name. The engine then runs its enabled components. and then select Update. In Object Explorer. enter values for the parameters. generators. You must install and run the Notification Services engine on each computer specified by the system name values in the ADF. or a process hosted by a custom application. You can now close WeatherADF. In the Update Instance dialog box. click Browse. To update the instance of Notification Services 1. When the update is completed. 7. The Notification Services Engine Earlier in this tutorial. Click OK. you configured a generator and a distributor for the application. Lesson 9: Registering. Review the Notification Services . 4. that event provider also would be run by the Notification Services engine. When you start the Notification Services engine. Enabling. 5. 6. point to Tasks. update the instance of Notification Services to modify the application execution settings in the application database. and Starting the Instance Updated: 17 July 2006 In this lesson.Update the Instance of Notification Services After you modify the ADF. Right-click Tutorial. and then click Update. locate the TutorialICF. click Close. .

you must provide a Windows user name and password. You will register the instance locally. The Engine for the Weather Application For this tutorial. This is the same computer name you provide for the _NSServer_ parameter when you create or update the instance of Notification Services. You must add a user for the Windows account or SQL Server login to the TutorialNSMain and TutorialWeather databases and then add the user to database roles. After you register the instance and configure security. you will run the Notification Services engine as a Windows service. the engine must have login access to the server and the correct database permissions. You use this same account when you register the instance of Notification Services. If you cannot use Windows Authentication. The Notification Services engine connects to the instance and application databases and runs its stored procedures. Configure Database Permissions for the Windows Service Use the following steps to configure database permissions for the account used by the Windows service to connect to the TutorialNSMain and TutorialWeather databases. see Security Considerations for Notification Services. When you register the instance. When you deploy an instance of Notification Services. make sure there is a SQL Server login that the Windows service can use. For more information about the security model. 2. The Windows service can use its Windows account or a SQL Server login you specify to log in to the database server. For more information. To run these stored procedures. make sure this Windows account can log in to the database server. If you can use Windows Authentication. These permissions are granted to the login through membership in database roles in the instance and application databases. named NS$Tutorial.For more information about the Notification Services engine. see Controlling Instance and Application Operation. and then grant only the necessary permissions to that account. when you register the instance of Notification Services. use an account that has few privileges. see Configuring SQL Server Permissions for an Instance of Notification Services. you will enable and start the instance of Notification Services. Choose a Windows account for the NS$Tutorial Windows service. To configure database permissions for the Windows service 1. . You will install the Windows service.

In the User name box. 2. Right-click Security. Expand the TutorialWeather database.. Click the browse ( . Right-click Security. 4. In the Database role membership box. expand Security. Expand Databases. The database user name is typically the same as the login name. In the Database role membership box. ) button to search for the login name. Click OK. The default location for this folder is C:\Program Files\Microsoft SQL Server0\Samples\Notification Services\tutorial. and then expand the TutorialNSMain database.To add a new login in Object Explorer. Open Windows Explorer. enter a name for the database user. create a database user for the login in the TutorialNSMain database and make the user a member of the NSRunService database role: 1. and select New Login. The database user name is typically the same as the login name. 2. 4. you must also make sure that the Windows service account has permissions in the folder where it writes notifications. .. 3. point to New. and make the user a member of the NSRunService database role: 1. click NSRunService. 5. right-click Logins.. enter the name of the login that is used by the NS$Tutorial Windows service. 2. enter a name for the database user. Create a database user for the login in the TutorialWeather database. 3. In the Login name box. 3. point to New. The login name must exactly match the name of an existing login in the instance of the Database Engine. enter the name of the login that is used by the NS$Tutorial Windows service. Configure Folder Permissions for the Windows Service Because the Weather application uses the File delivery protocol to deliver notifications. In the User name box. 6. To configure folder permissions for the Windows service 1.) button to search for the login name. 6.. and then select User. 4. Locate the Notification Services Tutorial folder. Using Object Explorer. Click OK. and then select User. The login name must exactly match the name of an existing login in the instance of the Database Engine. click NSRunService. 5. You can add Windows accounts or create SQL Server login accounts using this dialog box. Click the browse (. In the Login name box.

and select Register. leave Windows Authentication selected. 4. see Securing Notification Services. 5. If the service does not start. Right-click Tutorial. Notification Services grants Windows permissions to the service account. On the Security tab. When the registration is complete. Expand the Tutorial folder. and create performance counters. create the Windows service. Click OK to register the instance. point to Tasks. view the status of the Tutorial instance. Register the Instance and Create a Windows Service Use the following steps to register the instance of Notification Services locally and install the NS$Tutorial Windows service. 6. Verify that the account that is used by the service has the permissions that were discussed earlier. select SQL Server Authentication and enter the SQL Server login and password. 2. Checking Tutorial Instance Status To verify that the application is configured correctly and that the Tutorial instance is enabled and started. 5. or it cannot connect to the TutorialNSMain or TutorialWeather database. right-click Tutorial and select Enable. In Object Explorer. 4. To check tutorial instance status . 3. Select the Create Windows service check box. Right-click Tutorial. Right-click the Notifications folder and select Sharing and Security. and select Start. 7. expand Notification Services. it does not have the necessary permissions. and then expand the Weather folder. In Object Explorer. During this step. verify that the Windows account used by the NS$Tutorial Windows service has write permissions. For more information. Enable and Start the Tutorial Instance Use the following steps to enable the Tutorial instance and start the NS$Tutorial Windows service. If you use SQL Server Authentication to access databases. To enable and start the tutorial instance 1. click Close.3. Register the instance and create a Windows service 1. Enter the login account and password for the NS$Tutorial Windows service. either the service does not have a valid Windows account. Otherwise. 2.

If the status is still Enable Pending. all components should show Enabled. As part of developing a Notification Services application. Lesson 10: Adding Subscribers and Subscriptions In this lesson. you can view the status of all application components. Subscriber and Subscription Management Notification Services generates notifications based on subscriptions created by subscribers. Next Lesson Even though the Tutorial instance is enabled and running. All applications hosted by an instance of Notification Services use the same subscriber data. Each subscriber can have multiple devices. wait 30 seconds and then click Refresh. such as the city for weather forecasts. On the Applications page. On the Windows Services page. and which device receives the notifications. the system name of the component does not match the name of the computer where the Notification Services engine is running. and events. subscriptions. and then you will run the scripts to add subscriber data to the instance database and subscription data to the application database. Your . you can verify that the NS$Tutorial Windows service is running and. Subscriber data includes a subscriber ID and information about the subscriber's devices. such as e-mail addresses and text messaging addresses. Verify that the Server values on the Application page and the Windows Services page match. it will not produce notifications until you have added subscribers. in the Associated components box. Right-click the instance and select Properties. you can view which components are enabled on the Windows service. In the Current Status column. Subscriber data is stored in instance database objects. In the next lesson. you will review two VBScript files to understand how they submit subscriber and subscription data to Notification Services. you will add subscribers and subscriptions. These subscribers can be people or other applications. Subscription data specifies what application information the subscriber is interested in. you develop one or more interfaces so that subscribers can manage their subscriptions.1. If the status is Enable Pending. You should see one generator and one distributor.

NotificationServices.Subscrib er") nsSubscriber.CreateObject("Microsoft. First.NET application. Each application has its own subscription data. nsSubscriberDevice ' Create and initialize NSInstance object. such as day.vbs. These scripts illustrate how you can call Notification Services interfaces from COM components. This is not a common way to manage subscribers and subscriptions. or message importance.NotificationServices.Initialize "Tutorial" ' Create and initialize NSSubscriber object.Initialize (nsInstance) Next. nsSubscriber. time. AddSubscribers.vbs The first VBScript. but is useful for prototyping and testing your notification applications. For more information. create NSInstance and Subscriber objects: Copy Dim nsInstance.SubscriberId = "stephanie" nsSubscriber. Subscription data is stored in application databases. called AddSubscribers. see Developing Subscription Management Interfaces.application might have built-in logic to select subscriber devices based on conditional logic. but can be a Windows application. or any other interface you want to develop using the Notification Services subscription management objects. adds three subscribers to the Weather instance.SqlServer.Add . the Weather application bulk loads its subscriber and subscription data using two VBScript files. Set nsSubscriber = WScript.NSInstan ce") nsInstance. Notification Services is written in managed code (C#) and is designed to be accessible from both managed and unmanaged code. Web service. Set nsInstance = WScript.SqlServer. Most Notification Services applications provide an interface that subscribers can use to manage their subscriber and subscription data. nsSubscriber.CreateObject("Microsoft. This is frequently an ASP. add three subscribers using the Subscriber object: Copy ' Add subscribers. Review the Weather Subscription Management Interface For simplicity.

SubscriberId = "richard" nsSubscriberDevice.Initialize "Tutorial" ' Create NSApplication object.DeliveryChannelName = "FileChannel" nsSubscriberDevice.Add nsSubscriber.Add AddSubscriptions. First.DeviceAddress = "stephanie@adventure-works. Set nsSubscriberDevice = WScript.nsSubscriber.DeviceTypeName = "File" nsSubscriberDevice. called AddSubscriptions.SubscriberId = "richard" nsSubscriber.DeviceTypeName = "File" nsSubscriberDevice. . and Subscription objects: Copy Dim nsInstance.DeliveryChannelName = "FileChannel" nsSubscriberDevice.SqlServer.DeviceTypeName = "File" nsSubscriberDevice.NotificationServices.NotificationServices. nsApplication.Add nsSubscriberDevice. nsSubscription ' Create NSInstance object. adds one subscription for each of our three subscribers. create and initialize the NSInstance.Initialize (nsInstance) ' DeviceName must match subscriptions that use this device nsSubscriberDevice.SubscriberId = "stephanie" nsSubscriberDevice.CreateObject("Microsoft.DeviceAddress = "richard@adventure-works.com" nsSubscriberDevice.vbs.DeviceName = "myDevice" ' Add a file device for each subscriber nsSubscriberDevice.com" nsSubscriberDevice. NSApplication.Add Finally.NSInstan ce") nsInstance.SubscriberId = "david" nsSubscriber.Subscrib erDevice") nsSubscriberDevice.SqlServer.CreateObject("Microsoft.DeliveryChannelName = "FileChannel" nsSubscriberDevice.DeviceAddress = "david@adventure-works. create a SubscriberDevice object and add subscriber devices for each subscriber: Copy ' Create NSSubscriberDevice object.SubscriberId = "david" nsSubscriberDevice.vbs The other VBScript.Add nsSubscriberDevice. Set nsInstance = WScript.com" nsSubscriberDevice.

SetFieldValue "DeviceName".Subscrip tion") nsSubscription.SubscriberId = "richard" nsSubscription.NotificationServices.Add nsSubscription.CreateObject("Microsoft.vbs.Set nsApplication = WScript. set the common properties for all subscriptions you are loading: Copy nsSubscription.SetFieldValue "City".SubscriberId = "david" nsSubscription. 2. The default location for this folder is C:\Program Files\Microsoft SQL Server0\Samples\Notification Services\tutorial\Weather. "Subscriptions successfully added. "Seattle" nsSubscription. "Subscribers successfully added. "Orlando" nsSubscription.Initialize (nsApplication). "Seattle" nsSubscription.Initialize (nsInstance).SqlServer." Note: . Set nsSubscription = WScript. Using Windows Explorer.SetFieldValue "SubscriberLocale".Add nsSubscription.NotificationServices. You should receive the message.SetFieldValue "City". locate the tutorial Weather folder.vbs. Double-click AddSubscriptions. "en-us" Finally. "myDevice" nsSubscription.NSApplic ation") nsApplication." 3.SqlServer. To load subscriber and subscription data 1. "WeatherCity" Next.Add Load Subscriber and Subscription Data Now that you are familiar with the scripts.SetFieldValue "City".SubscriberId = "stephanie" nsSubscription. use them to load subscriber data into the Tutorial instance and subscription data into the Weather application. add the subscriptions: Copy nsSubscription. You should receive the message.CreateObject("Microsoft. Double-click AddSubscribers. "Weather" ' Create Subscription object.

To view subscriber data 1. see How to: Register the Core Notification Services Assembly for COM Interop. Event rules run in any quantum in which one or more event batches . 3. View Subscriber Data After you add subscriber data to the application. Lesson 11: Submitting Events to the Weather Application In this step.sql query. expand Queries. one for each subscriber.sql. View Subscription Data After you add subscription data to the application. and then double-click ViewSubscribersAndDevices. the wrong versions of the assemblies will be registered for COM interop and these scripts will not work. Press F5 to run the query. you can view the subscriber and device information using the ViewSubscribersAndDevices. Press F5 to run the query. you can view the subscriptions information using the ViewSubscriptions. For more information.0 after you install SQL Server 2005 Notification Services. 2.sql.If you install Notification Services 2. You should see three subscriptions. Close ViewSubscribersAndDevices. 3. double-click ViewSubscriptions. you will use a Transact-SQL script to submit events to the Weather application. such as the query in Lesson 5 The queries that generate notifications are fired during each generator quantum that has data to process. The notification generation queries you write join event data and subscription data to produce notifications. Event Data Events are data that your notification application uses to generate notifications.sql query. In Solution Explorer. expand Weather.sql. You should see subscriber and device information for three subscribers. 2.sql. and then view the resulting notifications. Close ViewSubscriptions. In Solution Explorer. To view subscription data 1.

You must provide the event batch ID and then provide values for the event fields.arrived. there is no reason to run rules. If there is no event data. no notifications are produced.Use the weather application's database. which you defined in Lesson 6. Caution: Do not run these statements individually. @BatchID OUTPUT. EXEC dbo.Flush event batch. You can display the event batch ID so that you can use views and stored procedures to view information about the event batch. After creating the event batch. You will specify the WeatherSPEventProvider non-hosted event provider as the event provider. run the AddWeatherEvents. Therefore. @High = 52. DECLARE @BatchID bigint. and must run in the same transaction. EXEC dbo.NSEventBeginBatchWeatherData N'WeatherSPEventProvider'. . you will use the NSEventFlushBatchWeatherData to close the event batch and submit it to the application database.Submit events. you use the NSEventWriteWeatherData stored procedure to add three weather events. you will use the NSEventBeginBatchWeatherData stored procedure to open an event batch. To run these queries. USE TutorialWeather. 120). First. @Forecast=N'Sunny' After you use this stored procedure to submit three events. They open and close an event batch. you will submit a batch of events using the event-submission stored procedures.NSEventWriteWeatherData @EventBatchId=@BatchID. WeatherData Events For this application. @City=N'Seattle'. Scheduled rules run in any quantum that has scheduled subscriptions expected to be processed.Start an event batch. -. @Date=CONVERT(DATETIME. Copy -.NSEventFlushBatchWeatherData @BatchID. '2005-04-20 13:00:00'. @Low = 31. This is one sample event: Copy -. Copy -. as documented later in this lesson. EXEC dbo.sql script.

Open this file to view the notification data. 3.sql query to view the events you just added. You should receive two result sets. Review the Transact-SQL code. To view event data 1. expand Queries.sql. and then open AddWeatherEvents. In Solution Explorer. Review the Transact-SQL code.sql query to add events to the Weather application. View Event Data Use the ViewWeatherEvents.Display event batch ID SELECT @BatchID 'Event Batch'. Submit Events to the Weather Application Use the AddWeatherEvents. The first result set returns an EventCount value of 3.htm file in the Notifications folder. expand Weather. 3. change the EventBatchId parameter as appropriate. If you submitted multiple event batches. Notification Id: 2 Notification Class Name: WeatherNotifications Subscriber Id: david Device Address: david@adventure-works. In Solution Explorer.Copy -. You should receive three notifications similar to the following: • • Notification Id: 1 Notification Class Name: WeatherNotifications Subscriber Id: stephanie Device Address: stephanie@adventure-works. 2.com Protocol Fields: Body: Weather report for the city of Seattle [2/21/2005 2:01:00 PM]: Sunny Expected low temperature : 31 F. The second result set returns an event batch ID of 1. visit our web site at http://www.asp?ta=y&tab=BW&tp=&czstr=Seattle Thank you for using SQL Server Notification Services.com/news/wea_front. Notification Services should have created a FileNotifications. Expected high temperature: 52 F. open ViewWeatherEvents. For more information. 2. Press F5 to run the query. To submit events to the Weather application 1. View Notifications After about 30 seconds.sql. Press F5 to run the query.msnbc.com Protocol Fields: Body: .

all three notifications generated from the events are in one file. If you submit more events.asp?ta=y&tab=BW&tp=&czstr=Seattle Thank you for using SQL Server Notification Services. including the subscriber ID and device address. Expected high temperature: 81 F. expand Queries.msnbc. 3.sql query. Also notice that there is a header for each notification. the additional notifications will be appended to this file. and then double-click ViewNotifications.com/news/wea_front. Expected high temperature: 52 F.• Weather report for the city of Orlando [2/22/2005 2:01:00 AM]: Partly Cloudy Expected low temperature : 59 F. This shows you information about the notification. For more information. You can view information about any notifications generated for the WeatherNotifications notification class by running the ViewNotifications. The Windows service may not have permission to write to the Notifications folder. Press F5 to run the query. visit our web site at http://www.asp?ta=y&tab=BW&tp=&czstr=Orlando Thank you for using SQL Server Notification Services. Close ViewSubscribersAndDevices. To view notification information 1. Troubleshooting If you do not see the FileNotifications. expand Weather.sql. Notification Id: 3 Notification Class Name: WeatherNotifications Subscriber Id: richard Device Address: richard@adventure-works.com/news/wea_front. Look in the DeliveryStatusDescription column for information about notification delivery. additional information should be provided in the Application log. 2.com Protocol Fields: Body: Weather report for the city of Seattle [2/21/2005 2:01:00 PM]: Sunny Expected low temperature : 31 F.sql. Because you are using the built-in File delivery protocol. visit our web site at http://www. In Solution Explorer. If there are any failures.msnbc. The actual text of the notification starts after "Body:". What's Next? . look in the Application log in Windows Event Viewer for events from Notification Services. For more information.htm file in the Notifications folder within one minute.

This tutorial has shown you how to build a simple prototype for a Notification Services application. use the following resources: • • Building Notification Solutions SQL Server Notification Services Samples . To continue learning about Notification Services.