DAT325 SQL Server 2005 (Codenamed “Yukon”): Using the Service Broker To Build Asynchronous, Queued Database Applications Roger Wolter Program Manager Microsoft
Yukon Service Broker What is Service Broker Why do asynchronous queued operations? Why are queued applications hard to write? Why do messaging in the database? Scenarios
What Is Service Broker? Platform for building asynchronous queued database applications Queues as first class database objects Queue manipulation built into TSQL Transactional message processing Reliable distributed queuing
Yukon Service Broker What is Service Broker Why do asynchronous queued operations? Why are queued applications hard to write? Why do messaging in the database? Scenarios
Why Do Asynchronous Queued Operations? Loose coupling Performance Load distribution Batch processing Scale out
Hello World Roger Wolter Program Manager SQL Server
Yukon Service Broker What is Service Broker Why do asynchronous queued operations? Why are queued applications hard to write? Why do messaging in the database? Scenarios
Why Are Queued Applications Hard To Write? Message Integrity Message Ordering Multi-Reader Queues Distribution Transactional Messaging Queue Reader Management
Message Integrity Asynchronous messages may be valuable business information “Message transport – not a database” Service Broker messages have all the reliability and high availability of SQL Server Transaction log Database Mirroring
Why Are Queued Applications Hard To Write? Message Integrity Message Ordering Multi-Reader Queues Distribution Transactional Messaging Queue Reader Management
Message Ordering Retries and routing affect message order Rollbacks can change processing order Order only reliable within a transaction Writing applications resilient to processing order changes can be difficult Service Broker dialogs ensure in order processing Across transactions Across sending threads Across receiving threads
Why Are Queued Applications Hard To Write? Message Integrity Message Ordering Multi-Reader Queues Distribution Transactional Messaging Queue Reader Management
Queuing At The Grocery Store
Queuing At The Airport
Why Are Queued Applications Hard To Write? Message Integrity Message Ordering Multi-Reader Queues Distribution Transactional Messaging Queue Reader Management
Message Transport Dialog Protocol End-to-end protocol Exactly once delivery In order delivery Symmetric failure Authentication and encryption Transport Protocol Efficient binary message format TCP/IP based Bi-directional, multiplexed, best-effort A BC D
Why Are Queued Applications Hard To Write? Message Integrity Message Ordering Multi-Reader Queues Distribution Transactional Messaging Queue Reader Management
Transactional Semantics SQL Broker State -B Msg-2 State -B Msg-2 State -A Msg-1 X1 Y1 Z1 Service Instance Msg-2 Send! State -A Msg-1 State -A Msg-1 State -A Msg-1 State -B X2 DB write Y2 DB write Z2 DB write One Atomic Transaction
Why Are Queued Applications Hard To Write? Message Integrity Message Ordering Multi-Reader Queues Distribution Transactional Messaging Queue Reader Management
Activation
Yukon Service Broker What is Service Broker Why do asynchronous queued operations? Why are queued applications hard to write? Why do messaging in the database? Scenarios
Why Do Messaging In The Database? Integrated API for Messages and Data Single connection for messaging and other database operations Transactional receives/sends from remote systems Integrated management, deployment, and operations Backup, restore, configuration, monitoring, security Startup and shutdown start, recover and stop Service Broker Queued messages and application session state may be queried Trace Events for monitoring and debugging Messages have database integrity and recoverability
Why Do Messaging In The Database? Performance advantages for database applications No two-phase commits for transactional messaging Single log write on commit No process boundary crossing to external messaging software Optimized “in-instance” delivery
Yukon Service Broker What is Service Broker Why do asynchronous queued operations? Why are queued applications hard to write? Why do messaging in the database? Scenarios
Scenarios Order entry Parallel stored procedure Planning
Event Notification Roger Wolter Program Manager SQL Server
Visit the SQL Server 2005 website: Learn more about SQL Server 2005 at Tech Ed Hands On Labs Rooms 6E and 6F 13 Hands On Labs Ask the Experts Track Cabanas located around CommNet Experts Available All Week Next Steps: SQL Server 2005 Exclusive Tech Ed Offer! Receive Beta 2 of SQL Server 2005 Register for SQL Server 2005 Beta 2 at: Exclusive Tech Ed Offer! Receive Beta 2 of SQL Server 2005 Register for SQL Server 2005 Beta 2 at:
SQL Server 2005: More Sessions DAT330 Tue 3.30 – 4.45 SQL Server 2005 (code named "Yukon"): Security Enhancements DAT329 Tue 5.00 – 6.15 SQL Server 2005 (code named "Yukon"): A Platform for Web Services DAT313 Wed 8.30 – 9.45 Introducing SQL Server 2005 (code named "Yukon") Data Transformation Services DAT377 Wed – Data mining in SQL Server 2000 and SQL Server 2005 (code named "Yukon") DAT317 Wed 2.00 – 3.15 SQL Server 2005 (code named "Yukon"): Setup and Deployment DAT318 Wed 3.45 – 5.00 SQL Server 2005 (code named "Yukon"):.NET Framework-Based Programming in the Database DAT323 Wed 5.30 – 6.45 SQL Server 2005 (code named "Yukon"): What's New in Replication DAT328 Thu 8.30 – 9.45 SQL Server 2005 (code named "Yukon"): Introduction to the Unified Dimensional Model in Analysis Services DATC15 Thu – Real Time Analytics: Bringing It All Together Using Analysis Services DAT321 Thu – SQL Server 2005 (code named "Yukon"): Management Tools DAT319 Thu 1.30 – 2.45 XML in the Database - the XML Data Type in SQL Server 2005 (code named "Yukon") DAT340 Thu 3.15 – 4.30 Applying and Targeting DTS in SQL Server 2005 (Code Named "Yukon") DAT324 Thu 5.00 – 6.15 SQL Server 2005 (code named "Yukon"): Backup and Restore Engine DAT322 Fri 9.00 – SQL Server 2005 (code named "Yukon"): SQL Server Management Object (SMO), Next Generation SQL-DMO DAT431 Fri – High Availability Technologies in SQL Server 2000 and SQL Server 2005 (code named "Yukon"): A Comparative Study DAT326 Fri – SQL Server 2005 (code named "Yukon"): Be More Efficient with T-SQL DAT325 Fri 1.00 – 2.15 SQL Server 2005 (code named "Yukon"): Using the Service Broker to Build Asynchronous, Queued Database Applications DAT327 Fri 2.45 – 4.00 SQL Server 2005 (code named "Yukon"): Inside XQuery
SQL Server Community sites List of newsgroups Locate Local User Groups Attend a free chat or web cast
Q1:Overall satisfaction with the session Q2:Usefulness of the information Q3:Presenter’s knowledge of the subject Q4:Presenter’s presentation skills Q5:Effectiveness of the presentation (9 is the correct answer) Please fill out a session evaluation on CommNet
© 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.