Sdílet prostřednictvím


Subscription Management API

When you build a subscription management interface, you manage three types of objects: subscribers, subscriber devices, and subscriptions. Your custom application uses the Notification Services subscription management API to create, modify, and delete these objects. Internally, the API stores and manipulates subscriber and subscription information in the instance and application databases.

Notification Services also provides views in the instance and application database that you can use to add basic subscriber, subscriber device, and subscriptions directly to the databases. These views are primarily intended for application development and testing.

Important

Always use the API or views to manage subscriber, subscriber device, and subscription data; never manipulate the underlying tables directly.

Subscription Management API

The following illustration shows how subscription management objects are used by a subscription management interface to communicate with Notification Services.

Subscription management architecture

  • The Subscriber object represents a single subscriber. A subscriber is a person or process identified by a subscriber ID. Subscriber data is stored in the instance database so that subscribers can be shared between applications.
  • The SubscriberDevice object represents a single subscriber device for a subscriber. A subscriber device is a deliver endpoint for notification delivery, such as an e-mail address.
    Each subscriber must have at least one subscriber device. Subscriber device data, like subscriber data, is stored in the instance database.
    Each subscriber device has a name and address, and is associated with a delivery channel. The delivery channel represents a specific delivery service used to deliver notifications to the device, such as a particular Simple Mail Transfer Protocol (SMTP) gateway. You configure delivery channels when you configure an instance of Notification Services.
  • A Subscription object represents a single subscription for a subscriber. Subscriptions define what notifications the subscriber wishes to receive. Subscriptions are for a specific subscription class, and can be for event-driven or scheduled subscriptions. Subscriptions define values for subscription class fields.
    If the subscription class uses condition actions, a subscription can also specify a condition that is used to determine if a notification should be generated for the subscription. Your application must use classes in the Microsoft.SqlServer.NotificationServices.Rules namespace to support condition development.
    Subscription data is stored in the application database.

Subscription Management Classes

The following classes in the Microsoft.SqlServer.NotificationServices namespace are used to develop subscription management interfaces.

Class Description

Subscriber

Represents an individual subscriber in a given Notification Services instance.

SubscriberEnumeration

Represents the collection of subscribers in a given Notification Services instance.

SubscriberDevice

Represents a device that can receive notifications.

SubscriberDeviceEnumeration

Represents a collection of subscriber devices.

Subscription

Represents a single subscription.

SubscriptionEnumeration

Represents a collection of subscriptions.

SubscriberLocale

Represents a geographic region for which a notification will be formatted.

SubscriberLocaleEnumeration

Represents the collection of subscriber locales available within a given Notification Services instance.

TimeZone

Represents a valid time zone, which is used for scheduled subscriptions.

TimeZoneEnumeration

Represents the collection of time zones available within a given Notification Services instance.

SubscriptionClass

Represents a subscription class, as specified for a given application.

SubscriptionClassEnumeration

Represents the collection of subscription classes in a given Notification Services application.

NSApplication

Represents a Notification Services application.

NSInstance

Represents a Notification Services instance.

NSException

Represents exceptions thrown when a Notification Services application error occurs.

Subscription Condition Classes

If a subscription class contains rules that use condition actions, you will use classes in the Microsoft.SqlServer.NotificationServices.Rules namespace to allow users to define conditions.

Class Description

AndCondition

Defines a set of conditions to be evaluated using AND Boolean logic.

BetweenLeafCondition

Evaluates to true if the test argument is between a minimum and maximum value, inclusive.

BooleanLeafCondition

Evaluates to true if its Boolean-valued argument is true.

ConstantValue

Represents an argument with a predetermined value.

ExpressionOperator

Expression operators.

ExpressionValue

Represents an argument whose value is determined by evaluating a simple arithmetic expression.

FieldValue

Represents a condition argument that obtains its value from an input field.

FilterAction

Filter actions.

FilterRule

Defines a filter over an input table or view based on the results of condition evaluation. A filter rule is composed of one or more filter statements.

FilterStatement

Describes a logic statement in the form "IF Condition THEN Action."

FunctionValue

Represents an argument that obtains its value from a Transact-SQL user-defined function.

IsNullLeafCondition

Evaluates to true if its argument is NULL.

LinkLeafCondition

Evaluates operations against the results of a related filter rule.

LinkLeafOperator

Operators for link leaf conditions.

NotCondition

Negates the result of another condition.

OrCondition

Defines a set of conditions to be logically evaluated using OR Boolean logic.

PropertyRule

Defines logic that evaluates to a scalar value for any row in an input table or view. A property rule is composed of one or more property statements.

PropertyStatement

Describes a logic statement in the form "IF Condition THEN Result," where the result is a scalar value.

RulesException

Represents the exception that is thrown by an object in this namespace.

RuleValue

Represents an argument that obtains its value from the evaluation of other rules.

SimpleLeafCondition

Compares two arguments using relational operators and returns a Boolean result.

SimpleOperator

Operators for simple leaf conditions.

TableInputType

Describes a table that can be used as an input to rule.

ViewInputType

Describes a view that can be used as an input to a rule.

Subscription Administration Classes

The classes above are intended for managing subscriber, subscriber device, and subscription data. If you are building an application to administer or manage instances of Notification Services, use the following classes in the Microsoft.SqlServer.Management.Nmo namespace to enable and disable subscribers and subscriptions.

Class Description

Instance

Provides methods for enabling and disabling subscriber management.

Application

Provides methods for enabling and disabling subscription management.

Subscription Management Views

Notification Services exposes views for managing subscriber data primarily for application testing. For more information, see the following topics:

See Also

Concepts

Starting a Subscription Management Project

Other Resources

Developing Subscription Management Interfaces
Managing Subscribers
Managing Subscriber Devices
Managing Subscription Data

Help and Information

Getting SQL Server 2005 Assistance