Thursday, September 24, 2009

70-433 SQL Server - SERVICEs & QUEUEs

CREATE SERVICE service_name [AUTHORIZATION owner_name] ON QUEUE [schema_name.]queue_name 

  [(contract_name | [DEFAULT]) [,...n];


A SERVICE (aka "Service Broker") require a QUEUE to be created, for example


CREATE QUEUE myQueue WITH STATUS=ON, ACTIVATION (

  STATUS=OFF, PROCEDURE_NAME=myProcForMessageHandling,

  MAX_QUEUE_READERS=3, EXECUTE AS SELF);


The above queue is ON and will receive messages, however as it's ACTIVATION STATUS=OFF messages will be held.


To change the "message type" handled use the ALTER SERVICE statement... 

No comments: