How the WCF LOB Adapter SDK works with IChannelFactory and IChannelListener

Q. It seems WCF LOB adapters works different from normal WCF service as there is no WCF Service hosted. Do we only use channelfactory to create custom channel for send wcf message to LOB without channellisterner? I just wonder how WCF LOB adapter run time works behind scene.


WCF Service is hosted using a class called ServiceHost.  The ServiceHost encapsulates the functionality regarding bindings, channels, dispatchers and listeners. 


WCF LOB Adapter is surfaced to the consumer as a WCF Binding, where the binding is used to create the channel stack. This binding can be considered a peer to other predefined WCF bindings such as BasicHttpBinding, WsHttpBinding, NetTcpBinding, etc and can be set via app.config or in code by the client application when calling a service.  This binding contains an ordered set of binding elements, with adapter being the key binding element that derives from TransportBindingElement class.  In an outbound scenario, the WCF LOB Adapter SDK runtime uses channel factory to create the adapter (i.e. transport channel).  In an inbound scenario, the WCF LOB Adapter SDK runtime uses channel listeners that listen for incoming channels in a service application. 


When a .NET application set the endpoint information with the WCF LOB Adapter binding, WCF under-the-covers calls



  • BindingElement::BuildChannelFactory, if the application uses the adapter in client endpoint or
  • BindingEement::BuildChannelListener, if the application uses the adapter in service endpoint.

When an application uses the WCF LOB Adapter in an outbound scenario, the WCF LOB Adapter SDK runtime interprets the BindingElement::BuildChannelFactory to build a Channel Factory for a specific type of channel.  When ChannelFactory::OnCreateChannel call is made by WCF, WCF LOB Adapter SDK runtime performs some of the following steps –



  • Checks the type of channel (IOutputChannel, IOutputSesionChannel, IRequestChannel, IRequestSessionChannel) and creates appropriate adapter send channel
  • Create connection pool
  • Create metadata cache


Then, on channel’s OnOpen() method, WCF LOB Adapter SDK runtime creates the connection (or uses the connection from pool), builds appropriate outbound handler that implements interface IOutboundHandler and/or IAsyncOutboundHandler and call the Execute/BeginExecute/EndExecute method for message exchange.


Similarly, when an application uses the WCF LOB Adapter in an inbound scenario, the WCF LOB Adapter SDK interprets the BindingElement::BuildChannelListner to accept channels of a specific type from the binding (i.e. the adapter).  The adapter checks for the type of channel (IInputChannel, IInputSessionChannel, IReplyChannel, IReplySessionChannel) and creates appropriate adapter receive channel.   Then on channel’s OnOpen() method, WCF LOB Adapter SDK retrieves the connection from the pool, builds appropriate inbound handler that implements IInboundHandler and/or IAsyncInboundHandler, and invoke the TryReceive()/WaitForMessage() methods to map the lob-specific method calls to WCF messages.   The listening application/service then uses this channel to receive incoming messages.


Check the EchoAdapterSample’s TestEchoAdapter_Channel (outbound) and TestEchoAdapter_Channel_Inbound (inbound) projects to see how the channel model is used directly to communicate with the adapter.  Then see how the WCF Service Model sample consumer projects TestEchoAdapter_Proxy (outbound) and TestEchoAdapter_Service_Inbound (inbound) hide the channel related details from the end-user.  The EchoAdapterSample is available from the WCF LOB Adapter SDK install directory under \Documents\Samples.

WCF LOB Adapter SDK Download

WCF LOB Adapter SDK is now generally available for download . . .


We are pleased to announce the release of WCF LOB Adapter SDK. 


Here are some of the related links:



  • WCF LOB Adapter SDK Technology Site
  • WCF LOB Adapter SDK Download Site
  • WCF LOB Adapter SDK MSDN Forum
  • BizTalk Server Roadmap
  • Building Custom WCF Channels

While the team is working on providing the official documentation, see some of the following posts to learn more about WCF LOB Adapter SDK.



The WCF LOB Adapter SDK ships with two samples – EchoAdapterSample and ContosoAdapterSample. The samples are installed as part of the setup in the {install_location}\WCF LOB Adapter SDK\Documents\Samples.


Download WCF LOB Adapter SDK

Rules Engines and Bayes’ Theorem

I had an interesting time yesterday writing a rule set in order to demonstrate that Bayesian analytics can be combined with rule processing in an entirelynatural fashion. Armed with an understanding of how a rules engine works, I also believe that it is entirely possible for a Rules Engine to implement and apply Bayes theorem in an efficient manner. I wrote the rule set for a Java-based rule engine called Jess, so please note this is not a BizTalk-related post.

My reason for writing the rule set was to counter some statements publishedon the Complex Event Processing Blog site, including references to a 20-year old academic paper that appears to claim, incorrectly, that rules engines cannot efficiently handle the concept of uncertainty. Bayes theory is one way of handling dependencies amongst uncertain beliefs (i.e.,calculating the probability (and changes to probability) of the accuracy ofhypotheses basedon uncertain beliefs and evidence). Another approach to handling uncertainty is to employ ‘fuzzy logic’, which I found myself demonstrating to a client (using MS BRE) just last week. But that’s another story…

If you are interested in this rather obscure discussion, please read on at http://geekswithblogs.net/cyoung/archive/2007/08/27/114988.aspx

Microsoft’s SOA and Business Process Pack incentive

Microsoft has a long history of taking hard problems and making them simple.  Twenty years ago simple word processing was a domain for experts.  Five years ago spinning up a simple intranet site for team collaboration required heavy assistance from IT and ongoing support well beyond the demands of its usefulness.  In the last several years Microsoft has made great strides in the SOA and Business Process Management space that will be equally transformative.


 


Your Microsoft account executive will work with you to determine just how impactful a SOA and BPM solution could be. To get started with your project,  Microsoft is providing an extra incentive. If you purchase the SOA and Business Process Pack between September 1, 2007 and February 29, 2008 you will receive a 10% discount from the total price of the individual products. 


 


Here is some additional reference material which you may find helpful:



 


1.      How to get started with SOA (see the attached/downloadable brochure) ESB Guidance


2.      Patterns and Prescriptive Architecture Guidance for Healthcare:


a.       Healthcare: Health Connection Engine;


b.       Consumer Engagement Reference Architecture (CERA)


3.      Office Business application (OBA) Reference Application Packs (RAPs) for Vertical Industries:


a.      Financial Services: Loan Origination Systems (OR-LOS)


b.      Manufacturing: Price Management; Supply Chain Management


c.       Public Sector: E-Forms Processing


d.      Retail: Store Operations


4.      Training:  Provided by Quicklearn, see their class at:  http://www.quicklearn.com/class_designing_enterprise_soa_solutions.aspx


 


 

Great Time at Houston TechFest

This last Saturday I had the honor of presenting at the first Houston TechFest.

Michael and his crew deserve to be congratulated in pulling this off so well.

The found the balance between number of topics and number of tracks just right, and

they pulled in over 450 people for the event.

Sogeti was there in force, with our Houston office going above and beyond. We

had no less than 3 speakers (Ben Scheirman, Mike Azocar and myself), each giving two

talks, and then members of the TechFest staff, and finally a table in the sponsor

area with many friendly faces connecting with the developers there.

I gave my “Introduction to C# 3.0” talk to well over 100 developers in the large Houston

Room, and early that day spoke to 20 valiant souls who showed up to “Introduction

to BizTalk Server 2006”. Both groups were absolutely great and it was a pleasure

to meet everyone.

Thank you to everyone in Houston who made this event possible, and I look forward

to next year!