The Hello World sample provides a simple Service Broker application that shows you how to send and receive a message by using Service Broker.
Samples are provided for educational purposes only. They are not intended to be used in a production environment and have not been tested in a production environment. Microsoft does not provide technical support for these samples. Sample applications and assemblies should not be connected to or used with your production SQL Server database or your report server without the permission of the system administrator.
Before running this sample, make sure that SQL Server is installed, including the following components:
- SQL Server Database Engine
- The AdventureWorkssample database
- Database Engine Samples
Running the Sample
To run the sample
- Open the project file in SQL Server Management Studio.
- Run Setup.sql. This script creates the Service Broker objects for the services.
- Open SendMessage.sql, select all lines from the beginning of the file to the comment ‘End Selection Here' and run selected part of the script. This part of the script begins a dialog conversation from InitiatorService to TargetService and sends a message on this conversation.
- Run ReceivesMessages.sql. This script receives Service Broker messages from the TargetQueue, displays the messages and ends the corresponding conversations at the target.
- Open SendMessage.sql, select all lines from the comment ‘End Selection Here' to the end of the file and run selected part of the script. This part of the script waits for a response message, displays the message and ends the corresponding conversation at the initiator. © 2008 Microsoft Corporation. All rights reserved.