Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
DB Engine
SQL ServerMSDESQL Server CE
Services
Analysis (Data Mining)Analysis (OLAP)DTSIntegration ServicesNotification ServicesReporting Services
Programming
CLRConnectivitySQLXML
Other Technologies
ClusteringEnglish QueryFull-Text SearchReplicationService Broker
General
Data WarehousingPerformanceSecuritySetupSQL Server ToolsOther SQL Server Topics
DirectoryUser Groups
Related Topics
MS AccessOther DB ProductsMS Server Products.NET DevelopmentVB DevelopmentJava DevelopmentMore Topics ...

SQL Server Forum / Other Technologies / Service Broker / June 2007

Tip: Looking for answers? Try searching our database.

Accessing Service Broker from .net

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
chrischandler25@gmail.com - 19 Jun 2007 18:06 GMT
Hi

I would like to use Service Broker for multiple SQL servers to
communicate, but also to push notification of data changes to my C#
application.

I see in some online docs that Service Broker can be accessed from any
language that supports T-SQL, but is it possible for the application
to act as a message target (reactive to events) or is it only possible
to poll the Service Broker functionality to receive new messages?

I'm not sure if the above question is clear.  With the MSMQ API it is
possible to use an event to determine when a new message is on the
queue at whice point it can be read, whereas I struggle to see that
this is possible with Service Broker.

Any help greatly appreciated.

Regards
Chris Chandler
Alan Brewer [MSFT] - 19 Jun 2007 18:40 GMT
There are a few things you can look into.

First, standard Broker applications use the RECEIVE Transact-SQL statement
to determine when there is a message to process on a queue. You can execute
the RECEIVE from any environment where you can execute a Transact-SQL
statement:
http://msdn2.microsoft.com/en-us/library/ms186963(SQL.90).aspx

Another possibility would be external activation. The basic activation
capabilities in SQL Server 2005 launch stored procedures when messages are
ready to process in a queueu. You can read up on activation basics here:
http://msdn2.microsoft.com/en-us/library/ms171617(SQL.90).aspx

In addition, there is a sample application that shows how to set up external
activation, which can launch an application. You can learn more about the
external activation sample at:
http://www.gotdotnet.com/codegallery/codegallery.aspx?id=9f7ae2af-31aa-44dd-9ee8
-6b6b6d3d6319


Also, if you're interested in getting notifications of events, you might
want to check out the event  notifications feature in SQL Server 2005:
http://msdn2.microsoft.com/en-us/library/ms182602(SQL.90).aspx

Signature

Alan Brewer [MSFT]
SQL Server Documentation Team

Download the latest Books Online update:
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx

This posting is provided "AS IS" with no warranties, and confers no rights.

chrischandler25@gmail.com - 20 Jun 2007 13:59 GMT
> There are a few things you can look into.
>
[quoted text clipped - 21 lines]
>
> This posting is provided "AS IS" with no warranties, and confers no rights.

Hi Alan

Many thanks for the suggestions, it certainly has thrown up a few more
options.  It seems common to execute a RECIEVE statement with the
WAITFOR statment and use this as a mechanism to detect new messages as
they arrive.  I am going to experiment with this approach and see how
I get on.

Thanks again
Chris Chandler
Adam Machanic - 20 Jun 2007 14:10 GMT
In addition to what Alan said, you might check out the samples that ship
with SQL Server 2005.  There is a sample called ServiceBrokerInterface that
sets up a .NET interface into SSB for you...

Signature

Adam Machanic
SQL Server MVP

Author, "Expert SQL Server 2005 Development"
http://www.apress.com/book/bookDisplay.html?bID=10220

> Hi
>
[quoted text clipped - 16 lines]
> Regards
> Chris Chandler
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.