SSB & WCF

First of all, I’ll say flat out that SQL Service Broker (SSB) is a fantastic bit of technology; I absolutely love it and I would rank it as one of Microsoft’s best kept secrets simply because it is not as widely known as it should be. Why hasn’t it been more widely adopted? Well there may well be many reasons but one obvious one is that it doesn’t inherently support interoperability. That is, it beautifully supports reliable conversations between services as long as those services are hosted within SQL Server 2005 databases. And it is this reason why many have talked about and looked at ways in which WCF and SSB could be used together to get SSB’s capabilities in an interoperable fashion.

However, most of the discussions around this have been centered on the notion of a SSB channel or transport for WCF and I have always had trouble with that notion because the picture seems inverted to me. That is why I was delighted to see this post recently by Harry Pierson http://devhawk.net/2007/02/06/How+I+Learned+To+Stop+Worrying+And+Love+WCF.aspx. In particular, in the 2nd last paragraph he writes “... since SSB is at a higher level of abstraction than WCF, it makes much more sense to layer SSB on top of WCF instead of the other way around” and I’ll just say that I agree completely.

SSB’s success is in the fact that the notion of a (long-running) conversation (currently only Dialogs are supported; Monologs are not yet supported) is a primitive artifact. That is, it is about reliable conversations, not just reliable message delivery. I always recall Pat Helland (one of the original brains behind SSB when he was still at Microsoft) saying once: “you don’t just want to know that the message was delivered reliably but rather that it was processed reliably”. And for that to happen in an asynchronous, scalable fashion when carrying out long-running work, then you must be able to engage in reliable conversations. If, as a service, you have asked me to do some long-running work, and I go off and do it, then I must be able to tell you at some point later on that I have done what you asked in a reliable manner.

So, if WCF and SSB are to one day complement each other, then I too see it more as a case where SSB's semantics around reliable conversations are primitive concepts that operate at a layer above WCF.