ScheduledRule Element (ADF)

Contains elements that define a single subscription scheduled rule.

Syntax

<SubscriptionClasses>
    <SubscriptionClass>
        ...
        <ScheduledRules>
            <ScheduledRule>

Element Characteristics

Characteristic Description

Data type

None.

Default value

None.

Occurrence

Required once or more per ScheduledRules element.

Updates

Can be added and deleted when updating the application.

Element Relationships

Relationship Elements

Parent element

ScheduledRules Element (ADF)

Child elements

RuleName Element for ScheduledRule (ADF)

Action Element for ScheduledRule (ADF)

OR

ConditionAction Element (ADF)

ActionTimeout Element for ScheduledRule (ADF)

Remarks

Scheduled rules contain the notification generation rules for scheduled subscriptions. Microsoft SQL Server 2005 Notification Services runs the scheduled rule in each quantum that has scheduled subscriptions due to be processed.

The notification generation rule typically joins event data from an event chronicle table with the subscription information and generates a notifications based on matches.

A ScheduledRule element can contain either an Action element or a ConditionAction element, not both.

Example

The following example shows how to define a subscription schedule rule, named StockSubScheduledRule, that contains an Action. This rule creates notifications for scheduled subscriptions, and also loads notification data into a subscription chronicle for use in data mining on subscription trends. This ActionTimeout value of P0DT00H00M45S gives the rule 45 seconds to complete successfully.

<ScheduledRule>
    <RuleName>StockSubScheduledRule</RuleName>
    <Action>
    -- Generate notifications from the event chronicle
    INSERT INTO ScheduledNotifications
    ( SubscriberId, DeviceName, SubscriberLocale,
      StockSymbol, StockPrice )
    SELECT S.SubscriberId, S.DeviceName, 
       S.SubscriberLocale, C.StockSymbol, C.StockPrice
    FROM StockSubscriptions S JOIN StockEventChron C
    ON S.StockSymbol = C.StockSymbol 
    WHERE S.StockTriggerPrice &lt;= C.StockHighPrice 
    GROUP BY S.StockSymbol, C.StockHighPrice
    -- Maintain the subscription chronicle
    INSERT StockSubscriptionChron
    (SubscriberId, StockSymbol, StockPrice)
    SELECT S.SubscriberId, S.StockSymbol, C.StockHighPrice
    FROM StockSubscriptions S JOIN StockEventChron C
    ON S.StockSymbol = C.StockSymbol
    </Action>
    <ActionTimeout>P0DT00H00M45S</ActionTimeout>
</ScheduledRule>

See Also

Reference

Application Definition File Reference

Other Resources

Defining Scheduled Rules
Updating Instances and Applications

Help and Information

Getting SQL Server 2005 Assistance