How Does Notification Services Work?

A Notification Services application collects events and subscriptions, generates notifications, and then distributes the notifications to external delivery services, such as a Simple Mail Transfer Protocol (SMTP) server. Notification Services accomplishes these tasks as follows:

  1. Notification Services stores subscriber and subscription data in SQL Server databases. Using subscription management objects, part of the Notification Services API, you can create a custom subscription management application to manage subscriber and subscription data.
  2. Using event providers, Notification Services collects event data and stores the event data in the application's database. For example, the file system watcher 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.
    Event providers can be run by the event provider host component, or they can run independently of Notification Services. For more information, see Event Collection Architecture.
  3. The generator matches subscriptions and events and generates notifications. The generator runs on an interval defined for the application, ensuring that subscriptions are evaluated regularly. The application developer writes Transact-SQL queries, which users provide parameters or conditions for, that determine how subscriptions are evaluated and what information goes into the notifications.
  4. The distributor formats notifications and sends them to subscribers using one or more delivery services. The application developer specifies the transformation from raw data to a formatted notification using a content formatter, such as the built-in XSLT content formatter.

The following illustration shows how Notification Services implements this architecture.

Notification Services architecture

The Notification Services engine runs the event provider host, generators, and distributors. This engine can be hosted by the NS$instanceName Windows service, which you can install when you register the instance, or by a custom application or process.