1 / 41

DAT300 Notification Services Programming: Introduction 

DAT300 Notification Services Programming: Introduction . Tete Mensa-Annan Program Manager SQL Server Microsoft Corporation. Focus of this session. Goal: Explain Notification Services concepts and features Non-Goal: Teach how to develop Notification Applications. Agenda.

dyanne
Télécharger la présentation

DAT300 Notification Services Programming: Introduction 

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. DAT300Notification Services Programming: Introduction  Tete Mensa-Annan Program ManagerSQL ServerMicrosoft Corporation

  2. Focus of this session • Goal: • Explain Notification Services concepts and features • Non-Goal: • Teach how to develop Notification Applications

  3. Agenda • What is SQL Server Notification Services • Introduction • Architecture • Under the hood • Instances, Applications, Versioning • Important concepts • Deployment • Scenarios

  4. What is the SQL Server Notification Services Platform? • A platform for developing and deploying highly scalable, rich Notification Applications • A rich yet simple declarative model used to describe Notification Applications • An efficient and scalable server, based on SQL Server 2000 and .NET Framework, that execute Notification Applications • You write Notification Application - Notification Services hosts and executes it

  5. Notification Applications A new class of scalable applications that enable new scenarios delivering personalized and timely information to any device. Any device Timely Personal

  6. Notification Applications Subscriptions(millions) Events(thousands) Notifications(millions) Match

  7. Generation vs. Delivery Activity Generation Delivery Receipt SQL Server on Windows, Oracle on Solaris, DB2 on S/390. Custom Data Store. SQL Server 2000 Notification Services Exchange Server, WinRTC, SMS Aggregator, Custom Mechanism. Outlook, XP Messenger, Pocket PC, SmartPhone 2002, SMS capable phone, Custom Mechanism. Information flow

  8. Why Notification Services? • Build and deploy application quickly(Time To Market) • You customize within Notification Services framework • You focus on application, not platform design • Richness • TimeZones, Recurrence, Fall behind, Retry • Performance • SQL matches Events and Subscriptions efficiently • A true ‘Internet’ scale solution

  9. Agenda • What is SQL Server Notification Services • Introduction • Architecture • Under the hood • Instances, Applications, Versioning • Important concepts • Deployment • Scenarios

  10. Architecture Overview Subscription Management Application Subscriptions Subscribers Subscriber Devices NotificationGenerator SMS File System EventCollector Distributor Email SQL Server XSLT Formatter SQL Match Rules File Custom Custom Formatter Event Provider Host Custom Events Event Batches Notifications App. specific Notification Batches Standard

  11. Architecture Details Subscription Management Application

  12. Subscription Management Application • Allows subscribersto manage subscriptions • Can be written in: • Managed code: ASP .NET, C#, VB.Net, etc • Unmanaged code: ASP, C++, VB6, etc

  13. Subscription Management Application • Deal with three classes • Subscriber • Represents whogets information • Usually one entry per person • Subscription • Represent what & wheninformation is sent • Multiple subscriptions per subscriber • SubscriberDevice • Represents where to send the information • Multiple devices per subscriber

  14. Architecture Details Event Providers

  15. Event Providers • Event Providers collect data changes and submits them as Events in Event Batches • Notification Applications have one or more Event Provider • Event Providers map to Event Classes • Notification Services ship with two standard providers • File System Watcher Event Provider • SQL Server Event Provider

  16. Custom Event Providers • Hosted Event Provider • Run in-proc with Notification Services Windows Service • Must implement IEventProvider or IScheduledEventProvider interfaces • Less custom code by leveraging Initialize, Run, Terminate, Schedule • Starts and Stops with Notification Services Windows Service • Non-Hosted Event Provider • Can run on alternate platform or remote system • Starts and Stops independently from Notification Services Windows Service • Event Submission Methods • Event Object • XMLLoader Object • Event Submission SQL Server Stored Procedures

  17. A Custom Event Provider Accepts event data from an external source Creates and populates an event object with event data Calls Event Collector “Write” for each event Calls Event Collector “Commit” to submit the batch of events Custom Event Provider Event Collector Event Provider Host Events Event Object Submissions events Write Write Write Commit IBM 102 ½ MSFT 65 ¼ ORCL 8 ¼

  18. A Custom Event Provider Accepts event data from an external source Creates an XMLLoader object; optionally initialized with SQL annotated XML event schema Called with an XML document or stream Batch size = the number of events within the document or stream Events XMLLoader Object Submissions Provider XML Event events LoadXML Provider Host

  19. Raw Data Table 1 Raw Data Table 2 Events Event Submission SQL Server Stored Procedures Un-Hosted Custom SQL Server Stored Procedures Provider: DECLARE @eventQuery DECLARE @postQuery SET @eventQuery = SELECT stocksymbol, stockprice from RDT1 UNION SELECT stocksymbol, stockprice from RDT2 SET @postQuery = DELETE RDT1 DELETE RDT2 EXEC NSEventSubmitBatchStockEvent @providerName, @eventQuery, @postQuery Provider SQL Stored Proc Submit

  20. Architecture Details Generator

  21. Generator Match Rule Generator • Matches events and subscriptions to produce notifications • You write “match rules”with full power of SQL(Transact-SQL, sp, transactions…) Subscribers Stock Subscriptions Subscriber Devices • SELECT Notify( • S.SubscriberId, • S.DeviceName, • S.Locale, • S.Symbol, • E.Price) FROM • StockEvents E, • StockSubscriptions S • WHERE • E.Symbol = S.Symbol AND • E.Price >= S.TriggerPrice Stock Events Stock Notifications

  22. Notification generation rules Subscription Event rules Multiple per Event Class Multiple per Subscription Class Notify when MSFT stock price goes above 70.00 Subscription Scheduled rules Multiple per Subscription Class TimeZone Recurrence Send MSFT stock price at 1PM Mon-Fri Chronicle state change rules Event Chronicle Rule One per event class Used to maintain Event state like Latest stock prices Subscription chronicle updates (usually embedded within Event & Scheduled Subscription Rules) Last time document changes were sent to subscriber Rule Classifications

  23. Rule Firing Sequence • Rules firings • Event Chronicle Rules Fired first • Subscription Event Rules fired second (Subscription Chronicle Updates) • Subscription Scheduled Rules fired third (Subscription Chronicle Updates) • Two in-order application processing options: • Quantum ordering • All event batches for quantum processed first • All scheduled subscriptions processed second • Never do more work than one Quantum worth at a time • Strict event batch ordering • Scheduled subscriptions due before event batch arrival are processed first • Event batch is processed • Scheduled subscriptions due after event batch arrival are processed until end of Quantum

  24. Generator Falling Behind • Generator schedule = Quantum • Application configurable Quantum limits • Event Chronicle Rule firing limit • Don’t process stock event batches older than 24hrs • Don’t process news stories older than 12 hours • Don’t process traffic events older than 2 hours • Subscription Rule firing limit • Don’t fall behind more than 15 minutes for basketball notifications • Don’t fall behind more than half hour on weather notifications • Don’t fall behind more than 20 minutes on traffic events

  25. Architecture Details Distributor

  26. SMS Distributor SMTP ContentFormatting SMS Notifications Custom Distributor • Formats and delivers Notifications • Transforms Notification using XSLT or Custom Content Formatter module • Applies device, country and region metadata to format the notification body and envelope • Sends the Notification via a delivery protocol

  27. Distributor Overview • Generator Creates Notifications • Per Notification Class • Raw notifications as rows in SQL tables • Distributor Loop • Periodically scan for notification batches ready to be distributed • Format raw SQL notification data • Assemble formatted notifications into protocol packets • Deliver the protocol packet • Handle delivery failures

  28. Content Formatting • Format raw SQL Notification data • Language-ContryRegion and DeviceType • Specified per NotificationClass • Stock notifications are formatted differently from Flight notifications • Built-in XSLT Content Formatter • Applies a XSLT to Notifications • Custom Content Formatter • Must implement IContentFormatterInterface • Initialize, ContentFormat, Close methods

  29. Digest and Multicast • Digest: several individual notifications for the same subscriber are combined into one • E.g. Stock notifications for MSFT, IBM, CSCO,… for a single subscriber are combined to be sent as one notification • Enabled per notification class • Customer Satisfaction • Multicast: same notification sent to multiple subscribers • E.g. Weather report for Seattle is the same for all recipients • Enabled per notification class • Formatting is done once • Underlying protocol can choose to physically send one message, or to send each message separately • Huge performance gain for distributor

  30. Retry Logic • Handling delivery failures: If a delivery operation fails, the distributor can make multiple attempts • The developer specifies the retry schedule per notification class (per protocol) • Series of delay intervals • Retry attempts will continue until the entire retry schedule has been completed, or until the notification expires • Notification is flagged as done and failed if all retry attempts fail • Vacuuming cleans up both successful and failed notifications

  31. Agenda • What is SQL Server notification Services • Marketing Fluff Introduction • Architecture • Under the hood • Instances, Applications, Versioning • Important concepts • Deployment • Scenarios

  32. Notification Services Instance • An Instance hosts one or more Notification Applications that share Subscribers • Each Instance runs as a multithreaded Windows Service • Hosts Event Providers, Generator, Distributor • Multiple Instances per computer • Test and production • Separate Windows Services,Databases, trust boundaries • Instance may span multiplecomputers • E.g., multiple Distributors Internet01 Subscribers Stock Sports News

  33. Notification Application • An Notification Application defines • One or more Event Classes, Subscription Classes (Rules), and Notification Classes • Each Notification Application is a separate SQL Server database • Event, Subscription, Chronicle and Notification data • System Elements • Event Providers (input), Generator (rule evaluation), Distributors (output)

  34. Notification Services Versioning • Different Notification Services Instances running on the same system may run different versions of Notification Services • Each Notification Services Instance must run the same version across all computers • Multiple versions of Notification Services may be installed side-by-side • Installation of a new version does not remove or replace existing versions

  35. Agenda • What is SQL Server notification Services • Marketing Fluff Introduction • Architecture • Under the hood • Instances, Applications, Versioning • Important concepts • Deployment • Scenarios

  36. Core Deployment Scenarios

  37. Security • Designed with Security in mind • Windows Authentication • SQL Server Authentication • Typical Accounts (low privileges) • Notification Services Windows Service Account • Domain\NSService + SQL Server NSService Login • SQL Server Service Account • Domain\SQLService • ASPNET Account • Domain\ASPNET + SQL Server ASPNET Login • DBA Account Operations Account • Domain\DBA Domain\Ops

  38. Summary • Notification Services is a platform • Enables rapid development of robust scalable Notification Applications • Easy to use Declarative Programming Model • A True .Net Enterprise Server Product

  39. Questions and Answers

  40. Don’t forget to complete the on-line Session Feedback form on the Attendee Web sitehttps://web.mseventseurope.com/teched/

More Related