Broker System Messages
08/29/2025 Service Broker uses three system message types to communicate status and error information from Service Broker. Most of the messages
Service Broker uses three system message types to communicate status and error information
from Service Broker.
Most of the messages in a Service Broker conversation are the application-defined messages
used to communicate between services. Each message must comply with a message-type
format that was defined by a
statement. The set of message types
allowed for a conversation is defined by the contract specified in the
statement.
In addition to the application-defined message types specified in the contract, any
conversation can also receive messages that use one of three system-defined message types.
Service Broker uses these message types to report errors and the status of dialogs. Every
application must contain logic to handle Error messages and End Dialog messages. If the
application sets a conversation timer on a dialog conversation, the application must contain
logic to handle Dialog Timer messages. Service Broker provides these message types to every
service, whether they appear in the contract for the service or not. For more information, see
Handle Service Broker error messages.
When a remote service ends a dialog with an error or the local broker detects an unrecoverable
error in a dialog, the local broker creates an Error Message. Error messages are of message
type. Error messages are validated as
well-formed XML.
The XML document that is contained in an error message uses the namespace. The root element of the document has the
local name
, and contains an element named
and an element named. The
element holds an integer value. The
element holds the human-readable text of
the message.
For example, an error message generated by a service that processes expense reports might
contain the following XML (reformatted for readability):
CREATE MESSAGE TYPE
BEGIN DIALOG
CONVERSATION https://schemas.microsoft.com/SQL/ServiceBroker/Error https://schemas.microsoft.com/SQL/ServiceBroker