Defining Subscription Rules

The primary purpose of subscription rules is to generate notifications: subscription rules join event data with subscription data to generate notification data. You can also use subscription rules to update event and subscription chronicles.

There are two types of subscription rules: event-driven and scheduled. Event-driven rules, referred to as event rules, generate notifications as soon as events arrive. Scheduled rules generate notifications according to the schedule defined in each scheduled subscription.

These rules can contain simple actions or the more complex condition actions. Simple actions allow subscribers to supply parameters to developer-defined queries. Condition actions allow subscribers to create the equivalent to WHERE clauses over the event fields.

Note

Do not use subscription rules to update the event or subscription tables. There are no guarantees about the order of processing for subscription rules, so the rules that update tables might be processed out of order. This creates system consistency implications. Also the subscription and event tables are likely to be among the largest in terms of number of records. Transact-SQL statements operating directly on these tables will take longer and require more system resources to process.

Note

For testing and troubleshooting rules, the Notification Services stored procedures are helpful. For more information, see NSPrepareRuleFiring (Transact-SQL) and NSExecuteRuleFiring (Transact-SQL).

In This Section

Topic Description

Defining Event Rules

Describes rules that generate notifications when events arrive and how to define these rules.

Defining Scheduled Rules

Describes rules that generate notifications at scheduled times and how to define these rules.

Defining Actions

Describes simple, parameterized actions for rules and how to define these actions.

Defining Condition Actions

Describes condition actions that allow users to define the equivalent to a WHERE clause for a rule and how to define these actions.

Writing Efficient Subscription Rules

Provides guidelines for writing rules that perform well and consume fewer system resources.

See Also

Concepts

Defining the Core Subscription Class
Defining the Subscription Schema
Defining Indexes for a Subscription Class
Defining Chronicles for a Subscription Class
Collecting Subscription-Related Information

Other Resources

Defining Subscription Classes
Notification Services Stored Procedures (Transact-SQL)

Help and Information

Getting SQL Server 2005 Assistance