SQL Server with Mr. Denny

Jun 2 2008   11:00AM GMT

Back To Basics: Service Broker Contracts

Denny Cherry Denny Cherry Profile: Denny Cherry

Every Service Broker conversation requires a contract.  The contract defines which message type or types will be used, as well as who (sender or receiver) can use which message types.  The contract is specified when the conversation is created.

The syntax for creating the contract is pretty straight forward.

CREATE CONTRACT [ContractName]
(MessageType SENT BY ANY)

The SEND BY portion can be used as many times as is needed for each Message Type which is defined on the contract.  It must be listed at least once as you can not have a contract with no message types.  You can specify that the Message Type be used by the INITIATOR, the TARGET or by both (by using the ANY keyword).

A more complex Contract would look something like this.

CREATE CONTRACT [ContractName]
(MessageType_I SENT BY INITIATOR,
MessageType_T SENT BY TARGET)

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: