Udostępnij za pośrednictwem


Completing a Conversation in a Single Database

New: 15 September 2007

This tutorial is intended for users who are new to Service Broker, but are familiar with database concepts and Transact-SQL statements. It will help new users get started by showing them how to build and run a simple conversation in a single database.

What You Will Learn

This tutorial shows you how to create the database objects that are required to support a simple request-reply Service Broker conversation. You will then start a conversation and use it to transmit messages.

Each Service Broker conversation has two ends: the conversation initiator and target. You will perform the following tasks:

  • Create a service and queue for the target and a service and queue for the initiator.
  • Create a request message type and a reply message type.
  • Create a contract that specifies request messages go from the initiator to the target, and that reply messages go from the target to the initiator.

You will then perform a simple conversation:

  • Start the conversation.
  • Send a request from the initiator to the target.
  • Receive the request at the target and send a reply to the initiator.
  • Receive the reply at the initiator.
  • End the conversation.

Messages are not transmitted across a network for conversations that have both ends in the same instance of the Database Engine. Database Engine security and permissions restricts access to authorized principles. Network encryption is not needed for this scenario.

This tutorial is divided into three lessons:

Requirements

To complete this tutorial, you should be familiar with the Transact-SQL language and how to use the Transact-SQL Query Editor in SQL Server Management Studio. You must be a member of the db_ddladmin or db_owner fixed database roles for the AdventureWorks sample database, or the sysadmin fixed server role.

Your system must have the following installed:

  • Any edition of SQL Server 2005.

  • Either SQL Server Management Studio or Management Studio Express.

  • Internet Explorer 6 or a later version.

  • The AdventureWorks sample database. For more information about how to install the sample databases, see Installing Samples. For information about the SQL Server 2005 Express Edition with Advanced Services samples, see Installing Sample Databases for Express Editions.

    Note

    When you review the tutorials, we recommend that you add the Next and Previous buttons to the document viewer toolbar. For more information, see Adding Next and Previous Buttons to Help.

See Also

Concepts

Completing a Conversation Between Databases
Completing a Conversation Between Instances

Help and Information

Getting SQL Server 2005 Assistance