Service Broker

Deactivate Queue

Use this section to DE-ACTIVATE the key service broker queues once issue has been identified


    ALTER QUEUE [QueueName] WITH ACTIVATION ( STATUS = OFF ) 

Reactivate Queue

Use this section to RE-ACTIVATE the key service broker queues once issue has resolved


ALTER QUEUE [QueueName] WITH ACTIVATION ( STATUS = ON )  

Disable Broker

ALTER DATABASE [DBName]  
SET DISABLE_BROKER WITH ROLLBACK IMMEDIATE 

Enable Broker

ALTER DATABASE PARIS 
SET ENABLE_BROKER WITH ROLLBACK IMMEDIATE 

Clear down Queues

DECLARE @handle UNIQUEIDENTIFIER; 
WHILE (SELECT COUNT(*) FROM [TargetQueueName]) > 0 
BEGIN 
RECEIVE TOP (1) @handle = conversation_handle FROM [TargetQueueName]; 
END CONVERSATION @handle WITH CLEANUP 
END 

>