Lesson 6: Adding an Event Provider

In this lesson, you will configure a non-hosted event provider that you will later use when you submit events to the Weather application. You will then update the instance of Notification Services to apply the changes to the application database.

Event Provider Primer

Event providers collect event data and submit it to Notification Services. When an event provider submits a set of events, it submits the events to an event class view. The set of events, called an event batch, is inserted into the event class view. Each event then becomes a row in the underlying event class table.

To help you develop and deploy a Notification Services application quickly, Notification Services includes three standard hosted event providers, a file system watcher, the SQL Server event provider, and the Analysis Services event provider. Using these event providers, you can easily gather events from an XML file, gather events using a Transact-SQL query, and gather events using an MDX query. The Notification Services engine hosts all these event providers. This means that the Notification Services engine starts and runs hosted event providers.

You can use the standard event providers in your application by specifying predefined names and custom operational parameters in the application definition. For more information, see Defining Event Providers.

If the standard event providers do not meet the needs of your application, you can develop event providers that are customized to your environment and event sources. The Notification Services engine can host your custom event providers, or they can be non-hosted.

Non-hosted event providers are stand-alone applications that submit events to a notification application without being hosted by the Notification Services engine. When you define a non-hosted event provider, you give the non-hosted event provider a name in the ADF. This name is used for tracking and troubleshooting event collection.

The WeatherSPEventProvider Event Provider

For this application, you will add a non-hosted event provider to the ADF. As mentioned earlier, you will just provide a name for this event provider so that you can later determine which events it submitted to the application.

The name of the event provider will be WeatherSPEventProvider. You will later use stored procedures to submit events to the Weather application, and you will use the name WeatherSPEventProvider when submitting those events.

Add the Provider Code to the ADF

The XML in this section defines the non-hosted event provider. Examine the XML and then follow the instructions to copy the XML to the ADF.

To add the provider code to the ADF

  1. Click Copy Code to copy the XML to the Windows Clipboard.

    <!-- Event Providers -->
    <Providers>
      <NonHostedProvider>
        <ProviderName>WeatherSPEventProvider</ProviderName>
      </NonHostedProvider>
    </Providers>
    
  2. In Solution Explorer, open WeatherADF.xml.

  3. Replace the following comment with the XML you just copied.

    <!-- Replace with Providers XML -->

  4. On the File menu, select Save WeatherADF.xml.

Update the Instance of Notification Services

After you modify the ADF, you update the instance of Notification Services to add the event provider definition to the application database.

To update the instance of Notification Services

  1. In Object Explorer, expand Notification Services.

  2. Right-click Tutorial, point to Tasks, and then select Update.

  3. In the Update Instance dialog box, click Browse, locate the TutorialICF.xml file, and then click Open.

  4. In the Parameters grid, review the values for the parameters. Use the same values you used to create the instance.

  5. Click OK.

  6. Review the Notification Services - Update Summary dialog box, and then click Update.

  7. When the update actions complete, click Close.

Review the Changes in the Application Database

When you update the instance, Notification Services adds information about the event provider to the NSProviders table in the TutorialWeather application database.

To view TutorialWeather event providers

  1. In Solution Explorer, expand Weather, and then expand Queries.

  2. Double-click ViewEventProviders.sql.

    You may have to connect to the instance of the Database Engine.

  3. Press F5 to run the Transact-SQL query.

Next Lesson

Lesson 7: Configuring the Generator and Distributor

See Also

Concepts

Notification Services Tutorial

Other Resources

Defining Event Providers
Building Notification Solutions
Introducing SQL Server Notification Services

Help and Information

Getting SQL Server 2005 Assistance