Contents
- 1 螳
- 2 Conversations()
- 3 Message(覃讌)
- 4 Contracts(螻)
- 5 Queues()
- 6 Service(觜)
- 7 Conversation Group(蠏碁9)
- 8 Service Broker vs MSMQ
- 9 2008覯?
Service Broker SQL Server 2005 襦蟆 覲伎 DBMS 蠍磯 譴 襦 觜蠍 覃讌 豌襴襯 襦蠏碁 弰企 . Service Broker 覿 襦蠏碁 覓朱 一危磯伎 語ろ伎 伎 襦蠏碁 觜蠍 襦蠏碁覦 誤手 . Service Broker襯 危危る れ螻 螳 伎 危願 . 企ゼ 危危覃 覿覿 危危 蟆朱 覺 .
- Conversations()
- Message(覃讌)
- Contracts(螻)
- Queues()
- Service(觜)
- Conversation Group(蠏碁9)
螳螳 伎 伎 危エ覲伎.
2 Conversations() #
Conversation企 螳 願, 谿企, 觜蠍一 覃讌 ′企. 覦 Dialog Conversation螻 Monolog Conversation 企蟆 螳讌 覦 , Dialog Conversation 螳 覦 覃讌 ′願, Monolog Conversation 1:れ 螳 覃讌 ′ 螳ロ 覦企. SQL Server 2005 Service Broker Dialog Conversation襷 讌.
(Reliable)
- 覃讌襯 / 覓語螳 覦 覃讌 / 譴 ろ朱 SQL Server 螻 覃讌 .
- 煙 覃讌 覦 覓語襯 豌襴 貊襯 磯 燕 螳 覩.
- 磯 覃讌襯 螻 螳 る 覃讌 覈 れ .
- "" るジ 詞 旧 譴 覃讌 覲蟆/覃語 讌 詩.
- Service Broker 覲伎 れ Off朱 覃讌 覲蟆曙覿襯 誤蠍 Checksum
谿(In Order)
- 覲企伎 襦 螻 豌襴 蟆 覩誤.
- 覃 磯 蟆曙企 ろ語 豸′ 覲企伎 るゴ蟆 覃讌襯 覦 覲企伎 襦 豌襴覩襦 襦蠏碁 覃讌 豌襴 豸′ 豌襴 蟆 一
觜蠍一(Asynchronous)
- ′ 襦蠏碁 豸′ 襦蠏碁 豌襴螳 覈 蟾讌 蠍磯るΥ 螳 .
- 2-Phase Commit豌 觜襯 ろ螻 襴 ろ 蟆壱朱 豌襴 讌一螳 覦朱 襦蠏碁 豌伎朱 れ 蟆 蟇煙讌 .
3 Message(覃讌) #
Message Conversation 蟲 覲( 一危)企. 覃讌 蟲譟磯 れ螻 螳.
覃讌 る 覦 覃讌 伎 . ° 覃讌 XML 螻, JPG . 覃讌 企 襦 るジ 一危 (Collation)襦 蟲焔 一危磯伎り 覃讌襦 ° 朱襦 覃讌 る 伎 一危 . 蠏碁覩襦 覓語 狩 覈 殊貅 .
覃讌 伎 焔 蟆 . 覿覿 覃讌 蠍磯蓋朱 XML 蟠ロ. 讌襷 XML 煙 覿螳 譟伎覩襦 旧朱 伎 蟆曙 蟆 旧 蟆 覦讌 蟆企. 覃讌 誤 覲企 sys.service_message_types .
4 Contracts(螻) #
Contracts 螳 曙企. Service Broker 螻曙 螳 蠍 覓語, 襯 豌襴 襦蠏碁 豌襴 企 覃讌 讌 蟆企手 . 曙 ろ 蠍 伎, 覯 螻曙 焔覃 覃讌 覈襦 覲蟆渚 . 狩 覦覯 螻曙 蟆企. 螳 企 れ螻 螳.
螻曙 誤 覲企 sys.service_contracts 朱, 螻所螻 誤 覲企 sys.service_contract_message_usages .
SELECT
C.name Contract
, M.name MessageType
, CASE
WHEN is_sent_by_initiator = 1 AND is_sent_by_target = 1 THEN 'ANY'
WHEN is_sent_by_initiator = 1 AND is_sent_by_target = 0 THEN 'INITIATOR'
WHEN is_sent_by_initiator = 0 AND is_sent_by_target = 1 THEN 'TARGET'
END SentBy
FROM sys.service_message_types AS M
INNER JOIN sys.service_contract_message_usages AS U
ON M.message_type_id = U.message_type_id
INNER JOIN sys.service_contracts AS C
ON C.service_contract_id = U.service_contract_id
ORDER BY 1, 2
5 Queues() #
覃讌螳 覃讌螳 ル 螻褐 Queue手 . Service Broker 覃覈襴 譟伎 蟆 螻, ろ( 企) ル. 蠏碁覩襦 覃讌螳 朱 . Queue螳 譟伎蠍 覓語 蟆壱(Loose Coupling)襯 伎手鍵 . Loose Coupling 蠍磯 螻 蠍磯 曙 螳 螳螳 襦 蟆 螳ロ 襷.
Service Broker 螳豢一 企 企 覃, 襷 蠍 ろる襯 . 企朱 螳豢一 企 覩襦 覈轟 牛 Queue襯 譟一 . CREATE QUEUE 覈轟朱 Queue襯 燕
FileGroup 讌 Internal Table 豺襯 讌 . 襷 覃讌 豌襴 ろ 蟲 蟆曙磯朱 Filegroup 讌 牛 H/W 焔レ 襦 企 .
SELECT
Q.name QueueName
, I.name AS InternalName
FROM sys.service_queues AS Q
INNER JOIN sys.internal_tables AS I
ON Q.object_id = I.parent_object_id
襷 Queue 伎 覲願 矩る SELECT覃 . Service Broker Queue 螳 企朱 觀磯ゼ 燕蠍 覓語 譟壱螳 螳ロ. 譟壱 Service Broker 蠍 至鍵 覓語 WITH (NOLOCK) 蟆 蟠螻.
- RETENTION 旧: 覃讌螳 覈 豌襴 蟾讌 Message Queue 覃讌 ル. RETENSION 旧 貅 螻, Status = 1 企 豌 曙 覃讌襯 詩螻, Status = 0企 覃讌螳 渚譟 詩.
- PRIORITY 旧: 2005覯 0(Zero)企. SQL Server 2005 一 蟯螻 谿朱 豌襴伎 . 蟲豌伎 一 豌襴 覦覯 谿蠍 覯朱 覩碁譟.
Queue 譬襯 朱 Queue sys.transmission_queue螳 . Sys.transmission_queue 覃讌螳 豕譬 覈讌 蠍 Service Broker螳 覃讌襯 朱 ロ 螳 蟆曙一 覃讌襯 ロ 螻褐企. Queue 一危磯伎る 1螳 譟伎覃, れ螻 螳 蟆曙 sys.transmission_queue襯 .
- 覈讌螳 るジ SQL Server 語ろ伎れ 譟伎 蟆曙
- 覈讌 Queue螳 觜燕 蟆曙(朱 語 伎 覃讌)
- 覈讌 Service Broker螳 觜燕 蟆曙
- 覈讌襯 蟆曙
6 Service(觜) #
Service 企 觜れ 企朱 覈覈. 蠏碁覩襦 れ 覩碁ゼ 螳讌 朱 Service SQL Server 讌 企 詩 訖企. Queue 企 蠏碁襦 Service 企 讌 伎 朱Μ 襴曙 覓語企. 讀, 覓朱Μ 蟲煙 る 螳 觜 企朱 襦蠏碁 覦壱 蠍 覓語企.
觜れ 覲企 sys.services 谿場 覲 朱, 觜れ 螻所螻 sys.service_contract_usages 谿場 覲 .
--螻所螻
SELECT
S.name AS Service
, Q.name AS Queue
, C.name AS Contract
FROM sys.services AS S
INNER JOIN sys.service_queues AS Q
ON S.service_queue_id = Q.object_id
INNER JOIN sys.service_contract_usages AS U
ON S.service_id = U.service_id
INNER JOIN sys.service_contracts AS C
ON U.service_contract_id = C.service_contract_id
7 Conversation Group(蠏碁9) #
Conversation Group 覃讌 谿 豌襴襯 旧企. 襯 れ, Message1, Message2, Message3螳 襦 豌襴伎朱 碁 ろ螳 , 覃 磯 蟆曙 螳螳 磯螳 覃讌襯 豌襴 Message2螳 Message3覲企 襾殊 豌襴る 企 覃讌 襯 覦( 蠏碁 谿瑚) 蟆企. 蠏碁9 企 覓語 願屋 譴.
Conversation Group れ螻 螳 .
BEGIN DIALOG @handle
FROM SERVICE InitiatorService
TO SERIVE 'TargetService'
ON CONTRACT 'TestContract'
WITH RELATED_CONVERSATION = @related_conversation_handle
8 Service Broker vs MSMQ #
Microsoft 觜蠍 豌襴 襭 MSMQ. Service Broker 譯 MSMQ 觜蟲, 企ゼ 襴覃 螳.
轟/伎 | MSMQ | SQL Service Broker |
螳蟆 | 覈 觜讌 覯 一 螻旧 | SQL Server 2005 殊伎殊 |
豕 焔 | 焔 | 朱 覃讌 れ 焔 |
碁 焔 | Distributed Transaction Coordinator襯 觜蟲 觜 碁 | SQL Server 企 碁 螻殊 碁 |
貊 豺 | 貊 SQL Server ろ 覿螳 | 覃讌 襦語 襦讌 SQL Server ろ 螳 |
螳 | 覃讌 螻 螻曙 牛 螳 螻 | 螳 |
蠍 | 蠍 讌 | 覃讌襯 覲企願鍵 SQL Server(豕 Express Edition企朱) 伎 |
覦煙 | 覓伎伎 る 覦煙 | ろる SQL Server 覦煙 襦襯 牛 覦煙 |
*豢豌
http://www.devx.com/dbzone/Article/34110
9 2008覯? #
2008覯 Service Broker 一襯 襷り幻 蠍磯リ骸 讌蟲襯 螻牛. 一 れ螻 螳 CREATE BROKER PRIORITY 覓語朱 れ . 1 10蟾讌 覯襦 一襯 れ 朱 襦 一螳 .
CREATE BROKER PRIORITY InitiatorAToTargetPriority
FOR CONVERSATION SET
(
CONTRACT_NAME = SimpleContract
, LOCAL_SERVICE_NAME = InitiatorServiceA
, REMOTE_SERVICE_NAME = N'TargetService'
, PRIORITY_LEVEL = 3
);
觜蠍 豌襴 覈磯 曙 Microsoft ssbdiagnose朱 碁Μ磯ゼ 螻牛 Service Broker 讌 譴. 2008覯 Dialog Conversation 讌 蟆朱 豈 一.