You work as the database administrator at Domain.com. The Domain.com network consists of a single Active Directory domain named Domain.com. All servers on the Domain.com network run Windows Server 2003 and all client computers run Windows XP Professional. The Domain.com network contains a SQL Server 2005 database server named Certkiller -DB01. Certkiller -DB01 hosts two database named CK_Staff and CK_Projects.
You create a Service Broker to enable the CK_Staff and CK_Projects databases to communicate. You create two message types named // Certkiller /Projects/Budget and // Domain.com/Projects/Expenses as well as the queue named // Domain.com/Expenses/ExpenseQueue.
You create a contract named // Domain.com/Expenses/ExpenseSubmission that uses the two message types and the queue. You want to create a new service named // Domain.com/Expenses that will listen for and accept messages from // Domain.com/Expenses/ExpenseSubmission by using // Domain.com/Expenses/ExpenseQueue.
Which CREATE SERVICE statement should you use?
A.
CREATE SERVICE [// Domain.com/Expenses]
ON QUEUE [// Domain.com/Expenses/ExpenseQueue];
B.
CREATE SERVICE [// Domain.com/Expenses]
ON QUEUE [// Domain.com/Expenses/ExpenseQueue] ([// Domain.com/Expenses/ExpenseSubmission]);
C.
CREATE SERVICE [// Domain.com/Expenses]
([// Domain.com/Expenses/ExpenseSubmission]);
D.
CREATE SERVICE [// Domain.com/Expenses]
ON QUEUE [// Domain.com/Expenses/ExpenseQueue] ([// Domain.com/Projects/Budget],
[// Domain.com/Projects/Expenses]);
Explanation:
The CREATE SERVICE statement should have an ON QUEUE clause to specify which queue should be used, and must specify the contract which the service will listen for and accept messages from.
Incorrect Answers:
A: If the CREATE SERVICE statement does not specify the contract, then that service can only initiate a conversation and cannot listen and accept messages from any contract.
C: The CREATE SERVICE statement must have an ON QUEUE clause. The ON QUEUE clause specifies which queue the service can use.
D: The CREATE SERVICE statement should specify the contract that the service will listen for and accept messages from. It should not specify the messages.
Reference:
Microsoft SQL Server 2005 Books Online (2006), Index: CREATE SERVICE statement