Download presentation
Presentation is loading. Please wait.
Published byLindsey Doyle Modified over 9 years ago
1
DAT300 SQL Server Notification Services: Application Development Ken Henderson Technical Lead, SQL Server Support Microsoft Corporation kenneth@microsoft.com
2
Development Process ASP ASP.NET VB Script C#, VB.NET VB Script T-SQL Script XML T-SQL Events Subscriptions Subscribers Notifications Match Rules Define Schemas and Rules Web Application Subscribers Subscriptions Events nscontrol create, register, update Build the SMA Load Sample Data Compile the application Extend the platformBuild the foundation XSLT C# VB.NET Event Providers, Content Formatters, Delivery Protocols Add Custom Components Operations T-SQL Perfmon SQLNS reports Integrate for end to end testing Tasks Focus Skills set
3
Demo Outline: Stock Quotes Notifications More sources of events (SQL Provider) Richer notifications (Content Formatter) File System Watcher for events Xslt content formatter Email for notifications Define Schemas Test application using built-in features Extend the platform Events, subscriptions, notifications Write Match rule
4
NS Instance Makes it possible for two or more applications to share the same set of subscribers Multithreaded Windows Service Hosts threads for Event Providers, Generator, Distributor Multiple Instances per computer Test and production Instance may span multiple computers E.g., multiple Distributors Defined by an xml configuration file NewsStockSports Subscribers StockInstance
5
NS Application Defines the logic of your notification application One or more per instance Entirely defined by an application definition file Schemas for Events, Subscriptions, Notifications Match rules Content Formatters Event providers Delivery protocols
6
Building The Foundation: Defining Schemas and Rules Model your Events as rows in a SQL table Model your subscriptions as rows in a table Use the power of SQL to write your match rule Format the raw notification using a basic xslt
7
Building The Foundation: ’Compiling’ the application nscontrol create Reads config. / ADF xml files Creates supporting databases, tables, views, stored procs… nscontrol register (on every machine running the service) Specify Windows/SQL credentials/encryption key Installs a multi threaded Windows service per instance Registers perfmon counters and SQLNS keys nscontrol enable Activates EP, GP, DP Start instance Event Provider disabled Generator disabled Distributor disabled Event Provider enabled Generator enabled Distributor enabled Event Provider enabled Generator enabled Distributor enabled Config InstanceApp1 App2 App3 ADF1 ADF2 ADF3
8
Building The Foundation: Loading Sample Data Load sample data: Subscribers, subscriptions, events Pick data that will generate notifications! Use built-in components FileSystemWatcher, xslt, smtp How? Subscribers and subscriptions: ASP, ASP.NET (unlikely at this stage of development, unless you are a UI god!) VB Script, using our object model C++, C#, VB, VB.NET, using our object model Events: using the File System Watcher provider C++, C#, VB, VB.NET, using our object model NEVER insert data directly in the SQLNS tables!
9
Building The Foundation VBS scripts Data Change s ExternalDeliveryExternalDelivery Event Provider Events Subscribers Subscriber Devices Subscriptions Notifications GeneratorDistributor SQL Match Rule File System Watcher Event Provider Host XSLT CF XSLT Email
10
Building The Foundation demo demo
11
Extending the platform VBS scripts Data Change s ExternalDeliveryExternalDelivery Event Provider Events Subscribers Subscriber Devices Subscriptions Notifications GeneratorDistributor SQL Match Rule File System Watcher Event Provider Host XSLT CF XSLT Email SQL Server provider
12
Event Providers: Example: SQL Server Event Provider Event Providers Get data into the Events table Built-in: FileSystemWatcher, SQL Provider SQL Server Event Provider Hosted by the Event Provider Host Executes a SQL query on a schedule to retrieve changes Store changes as data in the events table Events Data Source SQL Server provider Event Provider Host Query PostQuery Schedule Changes
13
SQL Server Event Provider Generator
14
SQL Server Provider demo demo
15
Extending the platform VBS scripts Data Change s ExternalDeliveryExternalDelivery Event Provider Events Subscribers Subscriber Devices Subscriptions Notifications GeneratorDistributor SQL Match Rule File System Watcher Event Provider Host XSLT CF XSLT Email SQL Server provider Custom CF Custom EP
16
Content Formatter Content Formatters Transform raw notification Built-in: XSLT Content Formatter Why a custom content formatter? Beyond simple xslt formatting (complex html, external formatting dependencies, compute operations) Target multiple devices/languages within a single piece of code (vs. Multiple xslt files) Performance Managed code dll loaded by the distributor. Cached in memory (stop, disable, update, enable, start) Exposes 3 methods: Initialize, FormatContent, Close
17
Distributor Content Formatting Example Notifications Subscribers Subscriptions Subscriber Devices Notification Fields City: Seattle HighTemp: 54 LowTemp: 45 Recipient Info SubscriberId: patricet SubscriberLocale: en-US DeviceType: Phone
18
Content Formatter demo demo
19
Extending the platform VBS scripts Data Change s ExternalDeliveryExternalDelivery Event Provider Events Subscribers Subscriber Devices Subscriptions Notifications GeneratorDistributor SQL Match Rule File System Watcher Event Provider Host XSLT CF XSLT Email SQL Server provider Custom CF SMS DP Custom EP.NET Alerts * File HttpExt
20
What We’ve Done More sources of events (SQL Provider) Richer notifications (Content Formatter) File System Watcher for events Xslt content formatter Email for notifications Define Schemas Test application using built-in features Extend the platform Events, subscriptions, notifications Write Match rule
21
Out of the box vs. What you author Subscription Management Application Data Change s ExternalDeliveryExternalDelivery Event Provider Events Subscribers Subscriber Devices Subscriptions Notifications GeneratorDistributor SQL Match Rule File System Watcher SQL Server provider Custom EP Event Provider Host XSLT CF Custom CF XSLT Custom DP Email.NET Alerts * File HttpExt
22
Summary Think of events, subscriptions and notifications as rows in SQL tables! Start building the foundation before extending it We want to hear from you: Come and talk to us about your application!
23
Community Resources http://www.microsoft.com/communities/default.mspx Most Valuable Professional (MVP) http://www.mvp.support.microsoft.com/ Newsgroups Converse online with Microsoft Newsgroups, including Worldwide http://www.microsoft.com/communities/newsgroups/default.mspx User Groups Meet and learn with your peers http://www.microsoft.com/communities/usergroups/default.mspx
24
evaluations evaluations
25
© 2003 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS SUMMARY.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.