Section 17.1. Architecture

17.1. Architecture

Before you look at the message flow within a Service Broker solution, there are some key Service Broker terms with which you should be familiar.

A message is a unit of information exchanged between applications that use Service Broker. Internally, a message is stored in SQL Server as a varbinary(max) data type. Each message has a message type that defines the name and type of data that a message contains. Each message has a unique identity. Each message also has a unique sequence number within its conversation, which is used to enforce message ordering.

A conversation is a reliable, persistent communications channel made up of a series of messages. Messages are guaranteed to arrive in the order in which they were sent and are guaranteed to arrive exactly once.

A conversation group is a set of related conversations for completing a specific task. A conversation group is defined by a participant and is not shared between participants in a conversationeach participant can group conversations as needed. Service Broker automatically adds a conversation group identifier to messages in related conversations. A conversation group facilitates the coordination of the messages within related conversations. A conversation group is associated with a specific service, and all conversations within the conversation group are messages to and from that service.

A contract specifies the message types used to perform a specific task and the message types that each participant in a conversation can use.

An application sends a message to a servicea collection of related tasksand receives messages from a queue, which holds messages in a database. Generally, one queue is used per service, although it is possible to share a queue across multiple services. A service specifies the contracts for which it is the target. A target service is an address that accepts requests for tasks identified by the contract specified by the service. An initiating service is the return address for a conversation with a target service.

A dialog is a conversation between two services. Dialogs use the message conversation identifier and sequence number to identify related messages and put them in the correct order. In this way, dialogs provide exactly-once-in-order message delivery. The initiator begins a dialog, and the target accepts the conversation started by the initiator.

Message delivery between applications is asynchronous and transactional. If a transaction rolls back, all Service Broker operations within the transaction are rolled back, including send and receive operations.

A route specifies where to deliver messages and specifies a service name, a broker instance identifier that uniquely identifies a Service Broker database, and a network address. SQL Server uses the service name and broker instance specified when a conversation is started to determine the route for a conversation.

A remote service binding relates a local database user, the certificate for the user, and the name of a remote service and is used to provide dialog security for conversations that target a remote service.

Figure 17-1 shows the flow of messages from an initiating client to a target, which processes the message and responds to the client.

Programming SQL Server 2005
Programming SQL Server 2005
ISBN: 0596004796
EAN: 2147483647
Year: 2007
Pages: 147
Authors: Bill Hamilton © 2008-2017.
If you may any questions please contact us: