This sample shows a simple, stateless application that uses the ServiceBrokerInterface sample.
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.
Building and Installing the sample
- In Visual Studio 2008, open HelloWorldCS.sln or HelloWorldVB.sln .
- Build the solution by pressing F6, or by selecting Build Solution from the Build menu.
- Run Install.cmd , located in the Scripts folder of the HelloWorld_CLR directory. This file sets up the environment, and then runs the Install.sql install script. If you built the Visual Basic version of the project, you might have to change the "cs" in the path for the assembly to "vb" in the Install.sql script.
Running the sample
- Run the HelloWorldClient.exe console application from the sample directory. To exit the client, press Enter after the client shows the response.
This sample requires Visual Studio 2008. Because the sample uses features of the common language runtime (CLR) that were not available in earlier versions, versions of Visual Studio earlier than 2008 cannot build the sample.
This sample demonstrates use of the sample object-oriented programming interface provided in the Service Broker Interface sample. All Service Broker functionality for the sample uses the Service Broker Interface.
There are two main parts of the sample: a client program that runs outside of SQL Server, and a CLR stored procedure that implements the service.
The external program begins a conversation from the service HelloWorldClient
to the service HelloWorldService
, and then sends a message on that conversation. This application sends a Request
message to the service HelloWorldService
. The activated stored procedure receives and responds to the message. The client receives a response, shows the response on the console, and then ends the dialog.
The CLR stored procedure implements the HelloWorldService
. Service Broker activates this procedure. The procedure reads a message from the queue. For a Request
message, the procedure responds with a Response message. For a Service Broker end dialog message, the procedure ends the conversation.
© 2008 Microsoft Corporation. All rights reserved.