IV.7.1. Better Messaging through SQL Server Service Broker

In days of yore (well, maybe only a few years ago), many database administrators and database developers yearned for databases that could talk to each other. Developers wanted one database to query another and, based on the response, take some specific action.

Because that capability didn't exist, developers wrote their own programs but still wished for databases that could talk to each other without requiring so much work on the developer's part.

With the release of SQL Server 2005, Microsoft released SQL Server Service Broker that filled this need. SQL Server 2008 includes some minor improvements of Service Broker.

Service Broker is a messaging service that is integrated into SQL Server. It allows database applications to easily exchange messages in a simple one-way conversation or a complex two-way dialog composed of as many messages as needed.

The two most important benefits of Service Broker are

  • Asynchronous messages: As soon as a message is sent to Service Broker, the database can consider the task done and move on to other things. For example, you might want a stored procedure to send a message in the middle of a couple other processes. The message can be sent to Service Broker, and then the stored procedure can move directly onto the rest of the processes. With synchronous messaging, the stored procedure wouldn't be able to continue until the message was actually sent. With Service Broker's asynchronous messaging ...

Get Microsoft® SQL Server™ 2008 All-In-One Desk Reference For Dummies® now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.