Defining Messages and Choosing a Message Type

For the AdventureWorks2012 database to communicate with the XCatMgmt database via Service Broker, a dialog between two services must take place. Within this conversation, each service sends messages to or receives messages from queues, providing the indirection needed for the underlying systems to stay loosely coupled.

Dialog messages are typed in order to constrain and (optionally) validate their content. You use the SQL Server database object MESSAGE to represent a typed message. Defining the messages to be transmitted is the first step in building a Service Broker application.

You create SQL Server messages by using the following syntax:

CREATE MESSAGE TYPE [ AUTHORIZATION ...

Get Microsoft® SQL Server 2012 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.