auckland connected systems user group november 19th 2009 jeffrey chilberto biztalk consultant

17
EXPOSING THE BUSINESS RULES SERVICE Auckland Connected Systems User Group November 19th 2009 Jeffrey Chilberto BizTalk Consultant http://bloggingabout.net/blogs/ chilberto

Upload: julius-houston

Post on 30-Dec-2015

219 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Auckland Connected Systems User Group November 19th 2009 Jeffrey Chilberto BizTalk Consultant

EXPOSING THE BUSINESS RULES SERVICE

Auckland Connected Systems User Group

November 19th 2009

Jeffrey ChilbertoBizTalk Consultanthttp://bloggingabout.net/blogs/chilberto

Page 2: Auckland Connected Systems User Group November 19th 2009 Jeffrey Chilberto BizTalk Consultant

Business Rules Service

Business Rules Engine

The Business Rules Framework is a Microsoft .NET-compliant class library.

It provides an efficient inference engine that can link highly readable, declarative, semantically rich rules to any business objects (.NET components), XML documents, or database tables.

Application developers can build business rules by constructing rules from small building blocks of business logic (small rule sets) that operate on information (facts) contained in .NET objects, database tables, and XML documents.

Reference: http://msdn.microsoft.com/en-us/library/aa561216(BTS.10).aspxNovember 19th 2009 2

Page 3: Auckland Connected Systems User Group November 19th 2009 Jeffrey Chilberto BizTalk Consultant

Business Rules Service 3

Solution Process

Jeff’s DefinitionThe Business Rules Engine is a .Net framework designed to inject functionality at runtime.

Host Application

Business Rules

EngineFacts

The BRE is comprised of a utilities to create and manage Rules,

Business Rules ComposerBizTalk Management Console

a repository for storing Rules, Rule StorePolicy Update Service

and a mechanism for executing rulesBizTalk Call Rules Shape from within an OrchestrationMicrosoft.RuleEngine LibraryNovember 19th 2009

Page 4: Auckland Connected Systems User Group November 19th 2009 Jeffrey Chilberto BizTalk Consultant

Business Rules Service 4

Why BRE?Separation of business logic from application allowing for more opportunities to leverage the logic elsewhere

Can lead to lower maintenance costs

Can lead to greater understanding of the business requirements

November 19th 2009

When to use BRE?Application involves significant decision making

Rules change frequently

Application is relatively stable

Page 5: Auckland Connected Systems User Group November 19th 2009 Jeffrey Chilberto BizTalk Consultant

Business Rules Service 5

Facts

.Net objects (methods, properties and fields) XML documents (elements, attributes) Database rowsets

Facts can be short term A short-term fact is specific to a single execution

cycle of the rule engine.

and long term facts A long-term fact is loaded into the working

memory of the rule engine for use over an arbitrary number of execution cycles.

November 19th 2009

Page 6: Auckland Connected Systems User Group November 19th 2009 Jeffrey Chilberto BizTalk Consultant

Business Rules Service 6

Policies

A policy is a versioned logical grouping of rules.

November 19th 2009

RulesA rule consists of a condition and actions. The condition is evaluated, and if it evaluates to true, the rule engine initiates one or more actions.

Page 7: Auckland Connected Systems User Group November 19th 2009 Jeffrey Chilberto BizTalk Consultant

Business Rules Service 7

VocabularyA collection of values, references to .Net class members, xpath statements and database objects used to make the creation of Rules simpler and more intuitive.

November 19th 2009

Page 8: Auckland Connected Systems User Group November 19th 2009 Jeffrey Chilberto BizTalk Consultant

Business Rules Service 8

ACSUG Order Management System

An order:

November 19th 2009

Page 9: Auckland Connected Systems User Group November 19th 2009 Jeffrey Chilberto BizTalk Consultant

Business Rules Service 9

Vocabulary Examples

Constant Value

Set of Values

November 19th 2009

Page 10: Auckland Connected Systems User Group November 19th 2009 Jeffrey Chilberto BizTalk Consultant

Business Rules Service 10

Vocabulary Examples

XPath Get

XPath Set

November 19th 2009

Page 11: Auckland Connected Systems User Group November 19th 2009 Jeffrey Chilberto BizTalk Consultant

Business Rules Service 11

Vocabulary Examples

The XPath Selector is used to define and select a 'fact‘ while the XPath field determines what aspect of the fact is to be selected.

November 19th 2009

Page 12: Auckland Connected Systems User Group November 19th 2009 Jeffrey Chilberto BizTalk Consultant

Business Rules Service 12

Rules ExamplesPromotion based on product id

multiple facts can be asserted Forward Chaining Priority

November 19th 2009

Page 13: Auckland Connected Systems User Group November 19th 2009 Jeffrey Chilberto BizTalk Consultant

Business Rules Service 13

Calling From Orchestration

November 19th 2009

Page 14: Auckland Connected Systems User Group November 19th 2009 Jeffrey Chilberto BizTalk Consultant

Business Rules Service 14

Common Orchestration Scenarios

Manipulation of business objects Configuration storage Default values Routing Document Validation

http://seroter.wordpress.com/2009/11/11/validating-incoming-data-using-the-biztalk-business-rules-engine/

November 19th 2009

Page 15: Auckland Connected Systems User Group November 19th 2009 Jeffrey Chilberto BizTalk Consultant

Business Rules Service 15

WCF Service

Loosely tied service with contract definitions

Facts are sent in and returned as un-typed objects

ServiceKnownTypeAttribute is used for serialization of messages and contract metadata without requiring a service rebuild

November 19th 2009

Page 16: Auckland Connected Systems User Group November 19th 2009 Jeffrey Chilberto BizTalk Consultant

Business Rules Service 16

WCF Service

Reference to Microsoft.RuleEngine libraryPolicy policy = new Policy(“ACSUG.ApplyPromotion”);policy.Execute(facts.ToArray(), interceptor);

IRuleSetTrackingInterceptor can be used to track activity of BRE

November 19th 2009

Page 17: Auckland Connected Systems User Group November 19th 2009 Jeffrey Chilberto BizTalk Consultant

Business Rules Service 17

References

MSDN Documentationhttp://msdn.microsoft.com/en-us/library/aa561216(BTS.10).aspx

BizTalk Hotrod – Exposing Business Rules Engine as a WCF Service (Issue 4)http://biztalkhotrod.com/Issues.aspx

Configurationhttp://www.biztalkgurus.com/newsletter/TheBizTalker-Volume-07.html

Static Methods Featurehttp://blogs.msdn.com/richardbpi/archive/2005/11/14/492489.aspx

Lengthy walk-throughhttp://msdn.microsoft.com/en-us/library/ms942178(BTS.10).aspx

November 19th 2009