Service Broker's integrated design provides benefits for application performance and administration.
Integration with SQL Server allows transactional messaging without the added overhead and complexity of an external distributed transaction coordinator. An application receives one or more messages, processes the message or messages, and sends a reply message within a single database transaction. If the transaction fails, all work rolls back, and the received message is returned to the queue so that another attempt can be made to process it. No actions take effect until the application commits the transaction. The application remains in a consistent state.
Administration is easier when data, messages, and application logic are all in the database, because administration for the application (disaster recovery, security, backup, and so on) then become part of the routine administration for the database, and the administrator does not have to manage three or four separate components.
With traditional messaging systems, the message store and the database can become inconsistent. For example, when one component is restored from a backup, another component must also be restored from a backup taken at the same time, or else the information in the message store does not match the information in the database. Because Service Broker keeps messages and data in the same database, inconsistency is not an issue.
A common development environment is also a benefit of database integration. The messaging part of an application and the data part of an application can use the same SQL Server languages and tools in a Service Broker application, taking advantage of the developer's familiarity with database programming techniques for message-based programming. Stored procedures that implement a Service Broker service can be written in either Transact-SQL or one of the common language runtime (CLR) languages. Programs outside the database use Transact-SQL and familiar database programming interfaces such as ADO.NET.
Additionally, database integration enables automatic resource management. Service Broker runs in the context of the SQL Server instance, so Service Broker monitors all messages ready to be transmitted from all databases in the instance. This allows each database to maintain its own queues while helping Service Broker to manage resource usage across the entire SQL Server instance.