How to: Activate Service Broker Message Delivery in Databases (Transact-SQL)

Applies to: SQL Server Azure SQL Managed Instance

By default, Service Broker message delivery is active in a database when the database is created. When message delivery is not active, messages remain in the transmission queue. To determine whether Service Broker is active for a database, check the is_broker_enabled column of the sys.databases catalog view.

Note

Activating Service Broker allows messages to be delivered to the database. A Service Broker endpoint must be created to send and receive messages from outside of the instance.

To activate Service Broker in a database

  • Alter the database to set the ENABLE_BROKER option.

Example

    USE master ;
    GO

    ALTER DATABASE AdventureWorks2008R2 SET ENABLE_BROKER ;
    GO

Note

The examples were validated on SQL Server 2008 R2 (10.50.x). We recommend using the AdventureWorks2008R2 sample database from AdventureWorks sample databases to complete the examples.

SQL Server Service Broker is supported in the current version of SQL Server.

See also