Udostępnij za pośrednictwem


Defining Chronicles for an Event Class

Event chronicles are supplemental event tables in your application database. You can use these tables to store event data for use by scheduled subscriptions or to keep an event history.

Why Use Event Chronicles?

In Notification Services, events arrive in batches. For example, if you are using a Transact-SQL query to obtain events, each query that returns one or more records creates one event batch.

When Notification Services generates notifications, it uses only the most recent event batches, and then marks the batches as complete. The event batch is never used again, except in limited circumstances such as system failures or restarts. If you have defined a data removal (vacuuming) schedule to remove old data, these completed event batches can be deleted from the database.

This model works well for event-triggered notifications, in which all subscriptions are matched against the current events to generate notifications. However, if your application supports scheduled subscriptions, you need a way to maintain event data so that a scheduled subscription can use relevant event data no matter when the subscription is scheduled to be evaluated.

Event chronicles provide storage for event data. For example, if you have a Weather application that supports scheduled subscriptions, you can use a chronicle to store the most current weather data for each city, and then update this data whenever new weather data arrives. Whenever a scheduled subscription is due to be evaluated, the scheduled subscription rule obtains the most recent data from the event chronicle.

You can use event chronicles for other purposes, too:

  • Archive all events, and when generating notifications, check for duplicate events.
  • Archive all events and use the data to create reports.
  • Archive high and low values, and when generating notifications, check whether the current event is inside the high-low range.

Note

The data removal processes do not remove old data from chronicles. You must create your own procedures and jobs for maintaining chronicle data.

Implementing Event Chronicles

To implement chronicles for an event class, you must define a chronicle table and an event chronicle rule. Each table is a chronicle. The event chronicle rule maintains data in the chronicles.

In This Section

Topic Description

Defining Event Chronicle Tables

Describes how to create the tables used as event chronicles.

Defining Event Chronicle Rules

Describes how to create the rules that maintain event chronicle tables.

Example: Using an Event Chronicle for Scheduled Subscriptions

Provides an example of how to use event chronicles for scheduled subscriptions.

Example: Comparing Event Data to Prevent Duplicate Notifications

Provides an example of how to use event chronicles to check for duplicate events before generating notifications.

Example: Using Event Data High Values to Prevent Duplicate Notifications

Provides another example of how to use event chronicles to check the previous event data values before generating notifications.

See Also

Concepts

Defining Core Event Class Properties
Defining Indexes for an Event Class

Other Resources

Defining Event Classes
Defining Notification Services Applications

Help and Information

Getting SQL Server 2005 Assistance