Current .Net Version: 2.0.50727
Home
Articles
C# & .Net Framework Reference
Practice C# Online
XML Web Services
RSS Feeds
Code Snippets
T-SQL Scripts
Videos
Valuable Links
Contact Us
Mike's C#, VS.NET and SQL Blog




ROR XML Info.
Problems Sending Messages with Service Broker
Author: Michael G.     Last Updated:12/26/2004 3:52:07 PM
Category(ies): SQL Server 2005
Description: If you're having problems with not being able to send and receive Service Broker messages, there are a few things you can check and do to resolve the problem(s).
  Add & View Comments About this Article

Tested with .Net 2.0.40607.42 and SQL Server 2005 9.00.852

If you're having problems with not being able to send and receive Service Broker messages, there are a few things you can check and do to resolve the problem(s):

  • Is Service Broker enabled?
  • Are the messages being held by the transmission queue?
  • Are the Initiator and Target Contract and Message Type names exactly the same

  • Is Service Broker enabled?
    By default, Service Broker is enabled for a database when it's created. However, it may have been disabled for some reason or another. To enable it, set the ENABLE_BROKER: -- Enable Service Broker: ALTER DATABASE [Database Name] SET ENABLE_BROKER; -- Disable Service Broker: ALTER DATABASE [Database Name] SET DISABLE_BROKER; To determine whether or not Service Broker is enabled for a particular database, execute the following T-SQL code: SELECT is_broker_enabled FROM sys.databases WHERE name = 'Database name'; -- Where 'Database name' is the name of the database you want to query. is_broker_enabled will be 1 if Service Broker is enabled for the given database, otherwise it'll be 0.
    Are the messages being held by the transmission queue?
    Before messages are sent to a Service Broker service, they're stored in a table which can be viewed via a catalog view called sys.transmission_queue. Any message that has not been delivered to a queue will show up in this view. Usually, messages end up in this queue when the Target Service is incorrectly spelled. Service names are case-sensitive. Check the to_service_name column on the view to determine if incorrectly spelled Service names are what are not allowing messages to be sent. Note: sys.transmission_queue exists in each database.
    Are the Initiator and Target Contract and Message Type names exactly the same?
    When sending messages to a Service, make sure that the Target Contract and Message Type names are exactly the same as that of the Initiator. Otherwise, the messages will not arrive at the Target. This is especially true if you're sending messages from one Service in one database to another Service in another database.


    Comments Click Here to Add your Comment
    No Comments Found.
     
    COPYRIGHT/DISCLAIMER | CONTACT US