I recently presented at the Auckland Connected Systems User Group. In order to prepare, I created several examples of methods of using the rules engine.
The sample solution is here.
Included in the sample solution are:
- Various Vocabulary definitions including using a function in XPath Field (TotalCostOfOrder)
- Various Rules definitions including retrieving from a database, using classes, adding XML Nodes to a document, forward chaining and priority
- Examples implementations of IFactRetriever
- BizTalk Application showing calling rules with both XML Document and objects
- BizTalk Application showing an example of using the BRE for routing
- A WCF Service and Client including an example tracking interceptor
The WCF Service was my focus of the talk and what I wanted to discuss most of all. I have found using the BRE very beneficial and now that I have spent time understanding it, I believe it helps to make more maintainable solutions by separating the business rules from the application framework. This allows for the business logic to more accessible and readable than embedded in BizTalk expressions, maps or custom classes.
Because of this I wanted to illustrate how a WCF service could be strongly typed but not require costly rebuilds when the facts or rules change. Though I believe strongly in SOA, I am not a fan of the un-typed XML in/XML out design. To achieve this, I took advantage of the KnownTypes attribute to allow WCF to serialize the payloads and to present metadata. In the example service, the specific classes are retrieved from the web.config, but there is not any reason why this could not have been retrieved from a more dynamic resource.
Cheers and feedback appreciated.
Sat, Nov 21 2009 7:18 PM