|
Service
Broker is a technology included in SQL Server 2005 that allows database
developers to build secure, reliable, and scalable applications using a
robust asynchronous programming model. Service Broker
infrastructure includes a transactional and asynchronous message
delivery system to exchange messages between applications and database
instances.
Using the service broker
Service
Broker is useful in applications that must use or display information
simultaneously from multiple databases, applications that must perform
large-scale batch processing, large applications that access multiple
SQL Server databases, and applications that collect data from a large
set of sources.
Enabling the service broker
In order to use the Service Broker you must enable the service. In order to do so check the is_broker_enabled column of the sys.databases catalog view (a 0 value means that the Service Broker is disable). If service message delivery is disabled use the following script to enable it:
ALTER DATABASE [databaseName] SET Enable_Broker;
GO
Endpoints
Defining
an endpoint is required in order to allow sending or receiving messages
by using the Service Broker. Use the following code to create an
endpoint (please notice that “LISTENER_PORT” should be opened at the
firewall if you want the Service Broker to be able to process messages):
CREATE ENDPOINT ServiceBroker_Endpoint
STATE = STARTED
AS TCP
(LISTENER_PORT=1443, LISTENER_IP=all)
FOR SERVICE_BROKER
(AUTHENTICATION=windows, ENCRYPTION=supported)
Disabling the service broker
Use the following script if you don’t want to continue using the Service Broker:
ALTER ENDPOINT ServiceBroker_Endpoint
STATE=STOPPED;
GO
ALTER DATABASE [databaseName] SET Disable_Broker;
GO
Coming next Once
we all know the basics about Service Broker it is time to see it in
action, but this will be up to the next post in this series. See you soon!!!
|