Pro SQL Server 2008 Service Broker

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

Service Broker is a key Microsoft product in support of message–based processing between applications. Pro SQL Server 2008 Service Broker helps you to take full advantage of this key Microsoft technology, beginning from the fundamentals, moving through installation and application development, and ultimately showing you how to develop highly available and scalable applications based upon the Service–Oriented Architecture that is fast gaining ground as the way forward in application development.

  • Comprehensive approach to developing with Service Broker
  • Strong focus on best practices and real–world scenarios
  • Covers the key aspects of distributed application design

What you’ll learn

  • Understand the fundamentals of message–based processing.
  • Install Service Broker and manage the environment.
  • Design databases for service–oriented applications.
  • Develop distributed applications.
  • Build in scalability and high availablity.
  • Apply best practices to avoid future trouble.

Who is this book for?

Pro SQL Server 2008 Service Broker is written for new and existing users of Service Broker who wish to develop service–oriented and distributed transactions that scale well, that are resilient against failure, and that are as future–proofed as possible from the application of current best practices in Service Broker development.

About the Apress Pro Series

The Apress Pro series books are practical, professional tutorials to keep you on and moving up the professional ladder.

You have gotten the job, now you need to hone your skills in these tough competitive times. The Apress Pro series expands your skills and expertise in exactly the areas you need. Master the content of a Pro book, and you will always be able to get the job done in a professional development project. Written by experts in their field, Pro series books from Apress give you the hard–won solutions to problems you will face in your professional programming career.

Author(s): Klaus Aschenbrenner
Series: The expert's voice in SQL server
Edition: 1
Publisher: Apress; Springer-Verlag [distributor]
Year: 2008

Language: English
Pages: 601
City: Berkeley, Calif. :, New York

Pro SQL Server 2008 Service Broker......Page 1
Contents at a Glance......Page 7
Contents......Page 9
About the Author......Page 17
About the Technical Reviewer......Page 19
Acknowledgments......Page 21
How This Book Is Structured......Page 23
Contacting the Author......Page 25
Fundamentals of MessageBased Processing......Page 29
Message Anatomy......Page 30
Messaging in Daily Life......Page 31
Asynchronous Message Processing......Page 32
Fault Tolerance......Page 33
Distributed Systems......Page 34
Performance......Page 35
Transaction Management......Page 36
Message Sequencing and Correlation......Page 37
SOA......Page 38
SODA......Page 39
MSMQ......Page 40
WCF......Page 41
Summary......Page 42
Conversations......Page 43
Dialog Lifetime......Page 44
Conversation Groups......Page 45
Message Sequencing......Page 46
Reliable Delivery......Page 47
Anatomy of a Service......Page 48
Message Types......Page 49
Contracts......Page 50
Queues......Page 51
Security......Page 52
Dialog Security......Page 53
Message Processing......Page 54
Performance......Page 55
Summary......Page 57
Defining Service Broker Applications......Page 59
Message Types......Page 60
Contracts......Page 63
Queue......Page 67
Service......Page 69
Sending Messages......Page 73
Retrieving and Processing Messages......Page 79
Retrieving Messages......Page 80
Processing Messages......Page 83
Error Handling in Service Programs......Page 88
Poison-Message Handling......Page 92
Ending Conversations with Errors......Page 95
Summary......Page 98
Activation Basics......Page 99
Internal Activation......Page 100
When Is Activation Needed?......Page 101
Internal Activation......Page 103
Controlling Message Throughput......Page 110
Stored Procedure Signing......Page 113
Changing the Execution Context......Page 118
Code Signing......Page 119
Granting Permissions......Page 120
Calling a Stored Procedure in Another Database......Page 121
Creating the Logging Functionality......Page 122
Code Signing......Page 124
Using a Single Stored Procedure to Process Many Queues......Page 125
Writing the Activated Stored Procedure......Page 126
External Activation......Page 129
Using the Event Notification......Page 130
Enabling External Activation......Page 131
Implementing the External Console Application......Page 133
Activating the External Console Application......Page 136
Configuring ExternalActivator......Page 138
Several Activated External Console Applications......Page 142
Parallel Activation......Page 145
Troubleshooting Activation......Page 150
When Messages Remain on the Queue......Page 151
Summary......Page 152
Service Broker with Managed Code......Page 153
The Managed Assembly......Page 154
Architecture and Design of the Managed Assembly......Page 157
Building a Managed Service Broker Client......Page 163
Implementing an Entry Point......Page 169
Deploying the Assembly......Page 171
Registering the Managed Stored Procedure......Page 173
Using the Service Program......Page 174
A Practical Example......Page 177
Summary......Page 187
Conversation Groups and Locks......Page 189
State Handling......Page 196
GET CONVERSATION GROUP......Page 197
The Receive Loop with State Handling......Page 198
State Handling with a Managed Stored Procedure......Page 203
A Practical Example......Page 209
The OrderService......Page 212
The CreditCardService......Page 222
The AccountingService......Page 225
The InventoryService......Page 228
Processing Response Messages......Page 232
The ShippingService......Page 236
Compensation Logic with Service Broker......Page 241
Basic Receive Loop......Page 248
Measuring Performance......Page 249
Batched Commits......Page 251
Cursor-Based Processing......Page 254
Set-Based Processing......Page 257
Binary Payload......Page 261
Summary......Page 264
Communication......Page 265
Sending a Message......Page 266
Routing......Page 268
Managing Routes......Page 270
The Application......Page 272
Setting Up Routes......Page 273
Establishing a Communication Channel......Page 276
Setting Up Security......Page 279
Setting Up Windows-Based Transport Security......Page 280
Setting Up Certificate-Based Transport Security......Page 285
Summary......Page 293
Advanced Distributed Service Broker Programming......Page 297
LOCAL Route......Page 298
TRANSPORT Route......Page 299
Service Broker Security Protocol......Page 301
Anonymous Dialog Security......Page 303
Configuration......Page 304
Setting Up Anonymous Transport Security......Page 305
Setting Up Full Dialog Security......Page 306
Setting Up Anonymous Dialog Security......Page 310
Transport Encryption......Page 313
Dialog Encryption......Page 314
Recommendation......Page 315
Setting Up Tracing......Page 316
The Captured Service Broker Message......Page 317
Transport Security......Page 320
Dialog Security......Page 321
Service Listing Manager......Page 322
Exporting a Service Listing......Page 323
Importing a Service Listing......Page 326
Initiator at Target......Page 327
Target at Initiator......Page 328
Summary......Page 330
Service-Oriented Database Architecture......Page 331
SOA......Page 332
Reasons for SODA Architectures......Page 333
Data in SODA......Page 334
Reference Data......Page 335
Messages......Page 336
SODA Features in SQL Server 2008......Page 337
XML Data Type Methods......Page 338
Native Web Services......Page 341
HTTP Endpoints......Page 342
Namespace Reservation......Page 344
Exposing Web Services......Page 345
Using Web Services......Page 351
SQLCLR......Page 352
Writing .NET Service Logic......Page 353
Implementing State Handling......Page 354
Implementing the OrderService......Page 356
Implementing the Other Services......Page 357
Interaction with the ShippingService......Page 359
Query Notifications Implementation......Page 363
SqlDependency......Page 365
SqlNotificationRequest......Page 370
Troubleshooting Query Notifications......Page 373
When to Use Query Notifications......Page 375
Summary......Page 376
Real-World Application Scenarios......Page 377
Service Broker Infrastructure......Page 378
Configuration Information......Page 379
Service Broker Objects......Page 382
Implementation of the Web Proxy......Page 383
Using the Web Proxy in a Smart Client......Page 397
Defining the Problem......Page 402
Implementing the Trigger......Page 403
Creating the Service Broker Infrastructure......Page 406
Writing the Service Program......Page 409
Workflow-Driven Service Broker Solutions......Page 412
Combining Service Broker and WF......Page 413
Implementing the Local Service......Page 416
Implementing the TargetService......Page 419
Implementing the InitiatorService......Page 427
Implementing a More Complex TargetService......Page 433
Batch Frameworks......Page 434
Creating the Service Broker Infrastructure......Page 435
The Implementation of the Batch Framework......Page 436
Batch Job Instantiation......Page 438
Batch Job Execution......Page 440
Implementing the New Batch Job Type......Page 443
Registering the New Batch Job Type......Page 445
Publish-Subscribe Frameworks......Page 446
Defining the Infrastructure......Page 447
Applying Publisher Logic......Page 449
Publishing Information......Page 454
Workload Throttling Through Service Broker......Page 456
Implementing the Service Broker Infrastructure......Page 457
Writing the Stored Procedure......Page 458
Queuing Up Some Synchronous Work......Page 462
Enabling Conversation Priorities......Page 464
Priority-Based Message Processing......Page 471
Service Broker Infrastructure......Page 472
Request Bindings......Page 474
Priority Table......Page 476
Front-end Service Program......Page 478
Back-end Service Program......Page 480
Using Priority-Based Message Processing......Page 482
Summary......Page 485
High Availability and Scalability......Page 487
Implementation Details......Page 488
Setting Up Database Mirroring......Page 489
Database-Mirroring Endpoint......Page 490
Security Configuration......Page 491
Database Preparation......Page 492
Using Service Broker with Database Mirroring......Page 494
Load Balancing......Page 496
Service Deployment......Page 497
Initiator Configuration......Page 498
Message Forwarding......Page 500
Network Topology Abstraction......Page 501
Work Distribution......Page 503
Activate Message Forwarding......Page 504
Setting Up Transport Security......Page 506
Route Configuration......Page 507
Monitoring Message Forwarding......Page 508
Configuration Notice Service......Page 509
Implementing the Configuration Notice Service......Page 510
Data-Dependent Routing......Page 516
Data-Dependent Forwarding......Page 517
Data-Dependent Redirection......Page 530
Summary......Page 537
SQL Server Management Studio......Page 539
Template Explorer......Page 540
Broker Statistics Report......Page 541
Using SQL Profiler......Page 546
Service Broker SQL Profiler Events......Page 547
The Initiator’s Side......Page 548
The Target Side......Page 550
System Monitor......Page 551
SQL Server Management Objects......Page 556
Creating Service Broker Objects......Page 557
Retrieving Information......Page 559
Conversation Problems......Page 560
Connection Problems......Page 563
Internal Activation Problems......Page 564
Configuration Mode......Page 566
Runtime Mode......Page 568
Service Broker Diagnostics Tool Output......Page 570
Summary......Page 575
Index......Page 577