When I first heard about it, I didn't think the DEFAULT contract in Service Broker had the potential to cause confusion. Goes to show what I know. The problem comes up when you assume "no specification" means "use DEFAULT". Not always…
Service Broker contracts indicate which message types can be sent from the conversation initiator, which message types from the conversation target, and which message types from both/either. Service Broker contains a DEFAULT message type (Validation=None) which is a real message type. The DEFAULT contract indicates that the DEFAULT message type (but no other message types) can be sent by ALL.
Here's the possibly confusing bit. On the target side (ie the receiver of the initial message in a conversation), the contract is specified on CREATE SERVICE.
CREATE SERVICE mytarget ON QUEUE myqueue
(contract1, — list of supported contracts
[DEFAULT] — we need this, if we want to use DEFAULT
CREATE SERVICE mytarget2 ON QUEUE myqueue2 — no contract at all supported
— not even DEFAULT
Leaving out the [DEFAULT] contract here means the target can't use it. You need to specify it.
For the initiator side (ie the sender of the initial message in a conversation) the contract is specified on BEGIN DIALOG.
CREATE SERVICE myinitiator ON QUEUE myqueue_init — no contract needed here
BEGIN DIALOG @handle
FROM SERVICE myinitiator
TO SERVICE 'mytarget'
– ON CONTRACT [DEFAULT] — not needed
However, in BEGIN DIALOG you CAN leave out the contract, and this does mean we're using the DEFAULT contract.
Also, sending a message using a message type, leaving out the message type means you're using the [DEFAULT] message.
SEND ON CONVERSATION @handle
– MESSAGE TYPE [DEFAULT] — not needed
Got it? DEFAULT message type and contract are the default, except on the target CREATE SERVICE, where its not a default.