SQL Server with Mr. Denny

Jun 16 2008   11:00AM GMT

Back To Basics: Service Broker Services

Denny Cherry Denny Cherry Profile: Denny Cherry

Services are used to bind contracts to queues.  They are also used to database to database, or server to server routing of messages via routes (we’ll talk about them later).  Unlike most other objects within SQL Server, the name of the service is case sensitive, no matter what collation you have set for your database.  When using server to server queueing the service names must be identical, including case as SQL Servers uses a hash of the service name to locate the correct service.

(Service names are not actually case sensitive if you arne’t using routing, but if you are going to start routing the messages later it’s better to start off getting them in the correct case.)

The syntax to create the service is pretty straight forward.

CREATE SERVICE ServiceName
ON QUEUE QueueName (ContractName)

If the service will only be the initiator then the contract name can be omited if preferred.  If you want to create a multi-user contact you can specify additional contracts by simply making a comma seperated list of contract names.

CREATE SERVICE ServiceName
ON QUEUE QueueName;

CREATE SERVICE ServiceName
ON QUEUE QueueName (ContractName1, ContractName2);

Denny

 Comment on this Post

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when other members comment.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to: