Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The method of activating the SQL Server Service Broker through a stored procedure is as follows:

  1. Create a stored procedure that enables the Service Broker using the ALTER DATABASE command.

  2. Use the CREATE MESSAGE TYPE, CREATE CONTRACT, CREATE QUEUE and CREATE SERVICE commands to define the necessary components for Service Broker.

  3. Use the ALTER SERVICE command to assign the correct contract to the service.

  4. Use the BEGIN DIALOG command to start a new conversation.

  5. Use the SEND message statement to send messages between services.

  6. Use the END CONVERSATION statement to end a conversation.

  7. Use the RECEIVE statement to retrieve messages from the queue.

  8. Use the WAITFOR statement to delay the execution of the stored procedure until a specific message is received.

  9. Use the END statement to close the conversation.

  10. Finally, use the ALTER DATABASE command to disable the Service Broker when it is no longer needed.