.NET-based library for Service Broker

I was browsing through some of the SQL Server 2005 code samples today (the ones that come with the product) and came across one that was a really nice idea. It's a library to encapsulate SQL Server Service Broker T-SQL calls in an object model, called ServiceBrokerInterface. Some of the other Service Broker samples are written using it. I've always told folks when they ask about using Service Broker on the client to use raw T-SQL from SqlCommand, but this is a nice wrapper. It can be used to write a client program that processes Service Broker messages or "service programs", that is, a stored procedure inside the server that is used as an activation procedure for a Service Broker queue. Works either way. Kudos to the SQL Server sample-writing team, and that's probably not the only gem in there. Reminded me of…

My all-time favorite SDK sample by far is the OLE DB Rowset Viewer. OLE DB is a fairly overwhelming API to most folks, with a large surface area. You could use Rowset Viewer to not only understand how the OLE DB spec worked, but how provider writers implemented edge case behavior. As an adjunct to coding it yourself, of course. You could work out a complex consumer-task (perhaps involving lots of related OLE DB properties) in the tool, and then go code it up once you "got the answer". Invaluable tool, amazing aid for experimentation.

5 thoughts on “.NET-based library for Service Broker

  1. Thanks for the compliments. As a Microsoft summer intern I was part of the team which produced the Service Broker class library and associated samples. It’s nice to know that the samples are available now and that people are fining them useful. I’d like to know which specific samples are available.

    Any feedback or questions are welcome.

    Rushi
    rushi (at) desai (dot) name

  2. Hi Rushi,

    The samples that are available besides the library itself are HelloWorld and NewCustomer, which use the library. Although the exact available samples appear to vary from release to release.

    Thanks for offering accept feedback and questions. Nice library.

  3. Hello,

    I’ve installed all of the samples from SQL 2005 Beta 2 and searched the entire tree for "ServiceBrokerInterface" and found nothing. Where are these libraries and C# code that reference them??

    Thanks!

  4. Hi Paul,

    It turns out that the Service Broker library is part of the *updated* beta2 samples. It’s not in the original beta 2, I got them as part of the beta program. If you can’t find the new samples, we’ll be announcing a place where they can be found soon.

Comments are closed.

Other articles

Imagine feeling confident enough to handle whatever your database throws at you.

With training and consulting from SQLskills, you’ll be able to solve big problems, elevate your team’s capacity, and take control of your data career.