2779B Module 12 - Using Service Broker
System Architecture
Object
Message type: defines valid message
Contract: specifies type of messages and their direction in a conversation
Queue: stores messages before sending and after receipt (inside sql server)
Service: Addressable endpoint for communication
Service Program: Processes messages
SQL:
ALTER DATABASE ADVENTUREWORKS SET ENABLE_BROKER;
Conversation Architecture
Features
Message: Information exchanged between two services
Dialog conversation: Messages being sent ans received by two services
Conversation Group: A group of related conversations
Route: A network address, and optionally a service name
Remote service binding: dbuser and the remote user
Conversation process:
Security
Transport Security
-services involved mutually authenticate
Dialog Security
-full
-use PKI messages are encrypted
-anon
-access through Guest account
Creating message types
-create message type SQL STATEMNT
Creating contracts
-Create contract tsql statement
-Initiator is the first service to send a message and remains the initiator.
Creating Queues
-Queues are just like sql server tables
-retention: conversations remain until conversation ends.
-activation: queue can activate the service which will send the message.
Creating Services
-service is an endpoint
-CREATE SERVICE <name> ON QUEUE
-specify the contract
Sending Messages
Receiving Messages