New Service Broker

Microsoft SQL Server 2005 introduces Service Broker, a new technology for building database-intensive distributed applications that are secure, reliable, and scalable.

Service Broker Description

Service Broker is a part of the Database Engine. Service Broker provides:

  • Facilities for storing message queues in SQL Server databases.
  • New Transact-SQL statements that applications can use to send and receive messages. Each message is part of a dialog: a reliable, persistent communication channel between two participants.

Service Broker provides unique capabilities for both applications within a single SQL Server instance and applications that distribute work across multiple SQL Server instances.

Within a SQL Server instance, Service Broker provides a powerful asynchronous programming model. Asynchronous programming allows database applications to improve response time and increase throughput by performing resource-intensive tasks as resources become available.

Service Broker also provides reliable messaging between SQL Server instances. Service Broker supports the vision of applications architected as services. In this architecture, the logic in a business system is implemented as a series of network-based services. Applications that require the functionality exposed in these services use messages to interact with the services. Service Broker uses TCP/IP to exchange messages between instances. Service Broker includes features to help prevent unauthorized access from the network and to encrypt messages sent over the network.

The programming model for Service Broker is identical for messages within a SQL Server instance and messages between SQL Server instances. By providing a consistent programming model, applications that use Service Broker can easily scale up or scale out without requiring changes to application code. Applications use Service Broker to exchange messages reliably, even when the applications do not run at the same time, or are not connected to the network at the same time.

By implementing messaging in SQL Server, Service Broker offers these advantages:

  • High scalability. Message queues are part of SQL Server databases, and can take advantage of the performance capabilities of the SQL Server Database Engine. In addition, multiple instances of services can be run to process messages from a queue, increasing the scalability of middle tier applications. Service Broker provides integrated program activation, which allows applications to use system resources efficiently. A Service Broker application can scale dynamically as load on the service varies.
  • Message coordination, ordering, and locking. Service Broker automatically handles many of the difficult tasks required to create messaging applications. An application that uses Service Broker always receives each message in a conversation exactly once. Messages in a conversation arrive in the order in which they were sent. Messages on related conversations are automatically grouped together to allow an application to easily coordinate messages to different services. Service Broker allows only one reader at a time to read messages in a conversation group. Applications use this built-in locking to perform concurrent processing safely and efficiently.
  • Integration with database data. Queues of messages stored in a SQL Server database are part of the database. They become an integral part of any backups of the database, and are restored along with the data whenever a database is restored from a backup. Messaging operations are an integral part of any transaction that includes database data. There is no need to manage distributed transactions, as is the case when a message queue is managed by a service that is separate from the database server.
  • Integration with database security. Service Broker uses the security features in SQL Server 2005 to help keep applications secure.

For more information about Service Broker, see Introducing Service Broker.

See Also


What's New in SQL Server 2005

Other Resources

Introduction to Service Broker Programming

Help and Information

Getting SQL Server 2005 Assistance