Managing Service Broker
In SMO, the Service Broker objects are found in the Microsoft.SqlServer.Management.Smo.Broker namespace, which requires a reference to the Microsoft.SqlServer.Smo.dll. A reference to the Microsoft.SqlServer.ServiceBrokerEnum.dll is also required for supporting class information.
SMO provides a set of Service Broker objects that permit programmatic management (DDL) of the Service Broker implementation. This includes defining the message types, contracts, queues, and services. Because SMO is a management tool that is not intended for data manipulation, sending and receiving Service Broker messages is not supported by SMO.
In SMO, the ServiceBroker object is the top-level class under which all the Service Broker functionality resides. A Service Broker implementation is required for each database that is participating in the distributed messaging application. Therefore, the ServiceBroker object is a child of the Database object.
The ServiceBroker object contains collections of the following objects that are used to define the Service Broker implementation:
MessageType objects represent message types that define the content of messages.
MessageTypeMapping objects represent contracts that specify the direction and type of messages in a given conversation.
ServiceQueue objects store messages prior to sending and after they are received. They provide asynchronous communication between services, as well as other benefits, such as automatically locking messages in the same conversation group.
BrokerService objects represent Service Broker services, which are the addressable endpoints for conversations. Service Broker messages are sent from one service to another service. A service specifies a queue to hold messages, and specifies the contracts for which the service can be the target.
RemoteServiceBinding objects represent the settings that Service Broker uses for security and authentication when communicating with a remote service.
ServiceRoute objects represents a Service Broker route, which contains the location information for the service and the database on which it is defined. A route is required for message delivery. By default, each database contains a route that specifies the location as the current instance of SQL Server.
See Also
Reference
Microsoft.SqlServer.Management.Smo.Broker