Current .Net Version: 2.0.50727
Home
Articles
C# & .Net Framework Reference
Practice C# Online
XML Web Services
RSS Feeds
Code Snippets
T-SQL Scripts
Videos
Valuable Links
Contact Us
Mike's C#, VS.NET and SQL Blog




ROR XML Info.
Service Broker - Basic Architecture
Author: Michael G.     Last Updated:12/17/2004 4:07:00 PM
Category(ies): SQL Server 2005
Description: An overview of how SQL Server 2005 Service Broker works.
  Add & View Comments About this Article

Tested with .Net 2.0.40607.42 and SQL Server 2005 9.00.852

  • Service Broker Architecture
  • Service Broker Conversation Architecture
  • Service Broker Message Types
  • Service Broker Contracts
  • Service Broker Links
  • Service Broker Queues
  • Service Broker Services
  • Service Broker Service Programs
  • Service Broker Dialogs
  • < Back | Next >
    Service Broker Architecture

    Service Broker Architecture Message Types Contracts Queues Service Programs Services Services Dialogs

    What is Service Broker?

    Here's Microsoft's definition of Service Broker:

    Service Broker is a new technology in Microsoft® SQL Server™ 2005 Beta 2 that helps database developers build secure, reliable, and scalable applications. Service Broker provides queuing and reliable messaging as part of the Database Engine. These features provide the infrastructure necessary to build high-performance applications that easily scale-up or scale-out.

    Service Broker provides you with queued messaging services. Messages and queues are the foundation of Service Broker. Messages are stored in queues and retrieved on demand or automatically in a FIFO (first-in, first out) order. Applications communicate with each other by sending and receiving messages from and to Service Broker queues. Once a message is stored in a queue, it is left there until either an expiration has elapsed or it has been retrieved. Service Broker provides you with an asynchronous communication architecture that allows you to scale high-demand applications easily.

    Service Broker ensures high availability between services. If server A is setup to send messages to server B, and a network failure occurs, server A will hold unread messages in the queue until either the expiration has elapsed or server B is again available.

    Service Broker is part of each database and is enabled by default. You can disable service broker for a given database by executing ALTER DATABASE [Database Name] SET DISABLE_BROKER or enabling service broker by executing ALTER DATABASE [Database Name] SET ENABLE_BROKER respectively.

    What Makes Up a Service Broker Application?

    • Message Types
      Message types define the type of data a message must contain (or not contain). Four are available: None, Empty, Well Formed XML and Valid XML with Schema Collection.
    • Contracts
      Contracts define what Message Types can be trasmitted and who (the target or initiating Service) can send them.
    • Queues
      Queues hold messages until they have expired or are retrieved. You can optionally configure a queue to automatically execute a stored procedure (Service Program) when messages arrive (called Activation).
    • Service Programs
      Service Broker Service Programs are the applications that perform the work of sending (to Services) and receiving messages (from Queues). A Service Program can be in the form of a stored procedure and/or external application.
    • Services
      A Service Broker Service is the interface through which messages are sent. When messages arrive at a server, it's the Service Broker Service that's responsible for handling and processing them. A service is bound to exactly one queue; however, a queue can hold messages for more than one service.
    • Dialogs
      A Dialog is a conversation between two Service Broker Services. A dialog is used to send messages from one Service to another using a compatible Contract. You don't send messages to a Queue directly. Rather, you send them to a Service.


    Comments Click Here to Add your Comment
    No Comments Found.
     
    COPYRIGHT/DISCLAIMER | CONTACT US