SSB FAQ (2) – Create a stored procedure as a service program

SSB FAQ (2) – Create a stored procedure as a service program

 

The following code snippet shows you how to create a stored procedure as a service program.

 

CREATE QUEUE [dbo].[Queue_OutStock_Out] WITH STATUS = ON , RETENTION = OFF ,

ACTIVATION

(  STATUS = ON ,

PROCEDURE_NAME = [dbo].[usp_OutStock_OnReceiveMessage] ,

MAX_QUEUE_READERS = 5 , EXECUTE AS N'dbo'

)

 

Arguments:

RETENTION

Specifies the retention setting for the queue. If RETENTION = ON, all messages sent or received on conversations using this queue are retained in the queue until the conversations have ended. Setting RETENTION = ON can reduce performance. The default value for REENTION is OFF.

 

MAX_QUEUE_READERS = max_readers

Specifies the maximum number of instances of the activation stored procedure that the queue starts at the same time.

 

You can temporarily disable activation action by executing the following script.

Alter Queue Queue_OutStock_Out WITH ACTIVATION (STATUS=OFF)

 

The URL below has more detail.

SQL Server 2005 Beta 2 Service Broker: Stored Procedure acts as a service program

http://www.cnblogs.com/rickie/archive/2005/04/16/138658.html

 

 

 

原文地址:https://www.cnblogs.com/rickie/p/605408.html