Title: Welcome to the Twin Cities BizTalk User Group
1Welcome to the Twin Cities BizTalk User Group
2Implementing a BizTalk Rule Engine Solution.
Tips, Tricks Best Practices
- Balaji Thiagarajan
- ITRGroup, Inc
- www.itrgroupinc.com
3This event is sponsored byITR Group, Inc
4Introduce you to the group
5About me
- Working on BizTalk since the BizTalk 2000 days
- MCP in BizTalk since August 2002
- Worked for Microsoft Consulting Services, India.
- Currently working as a BizTalk Consultant for
ITRGroup, Inc.
6Agenda
- Overview of BizTalk Rules Engine(BRE)
- Features
- Building Rules
- Architecture
- Rules Orchestration
- Q A
7BRE Overview
- What are Rules?
- Rules are
- Declarative statements for capturing changing
business policies - Represented as IF ltCondition(s)gt THEN
ltAction(s)gt - Logically grouped into policies
- Rules allow users to
- Define own business policies without coding
- Change business policies in real time without
rebuilding/redeploying applications
8BRE Overview
- BizTalk Rules in a Nutshell
- Lightweight .Net engine
- Host-agnostic for in-process scenarios
- Integrated with BizTalk Server
- Powerful Framework Tools
- Supports Developers, IT Admin and IW
- Complete API for design execution
- Rich Modeling Capabilities
- Data Sources .Net Objects, XML, DB
- Logical expressions
- Enterprise-Ready
- Security, Performance, Versioning
9BRE Overview
- Rules Tools - Development
- Business Rule Composer
- Bind Vocabularies
- Build test policies
- Deploy Policies
- Visual Studio.NET
- OD Integrate policies processes
- Build supporting code
- Fact Retrievers long term facts
- Custom operations
10BRE Overview
- Rules Tools Admin/Management
- Rule Engine Deployment Wizard
- Deploy policies
- Export/Import policies vocabularies
- HAT
- Tracking configuration
- Policy execution monitoring
11Demo 1
- Automated Loan Processing
12Agenda
- Overview of BizTalk Rules Engine(BRE)
- Features
- Building Rules
- Architecture
- Rules Orchestration
- Q A
13Features
- Design Time
- Rich built-in library that includes
- Temporal, relational predicates
- Support for ranges and regular expressions
- Arithmetic operations
- Engine execution control functions
- Support for complex logical expressions(AND / OR
/ NOT) - User-defined predicates/functions/actions
- Policy testing
14Features
- Run Time
- Application integration via Policy object
- Support for long-term (semi-static) short-term
(dynamic) facts - Performance optimizations
- Forward Chaining Inference Mechanism
- Finds all true statements given knowledge base
and a new set of facts - Execution tracking
15Agenda
- Overview of BizTalk Rules Engine(BRE)
- Features
- Building Rules
- Architecture
- Rules Orchestration
- Q A
16Building Rules
- .Net Objects
- Drag and drop public members
- Actions
- Predicates
- Arguments
- Assert .Net Instances
- IF MyClass.A 5
- THEN MyClass.B()
MyClass
Engine
Assert
17Building Rules
- Data Connection
- Perform dynamic queries on a DB
- DataConnection(DataSetName,TableName,
- SqlConnection,SqlTransaction)
18Building Rules
- Data Connection - Retrieve
IF Table.CustType Residential AND
Table.Balance gt 1000 THEN .
SELECT FROM Table WHERE CustType
Residential and Balance gt 1000
TDR
Engine
TDR
19Building Rules
IF Table.CustType Residential AND
Table.Balance gt 1000 THEN Table.Status Over
Limit
SELECT FROM Table WHERE CustType
Residential and Balance gt 1000
Modify
Call DC.Update() and commit the SQL Transaction
TDR
Engine
TDR
Modify
20Building Rules
- TypedDataTable
- Wrapper class on ADO.NET DataTable
- Rules built against DB tables, using Database
binding type field - Asserts individual TypedDataRows
- Note If you assert a DataTable without the
TypedDataTable wrapper it is treated as a
standard .NET object
21Demo 2
- Automated Loan Processing with DB
22Building Rules
23Building Rules
24Building Rules
- TypedXmlDocument
- IF orderline.quantity gt 5
- THEN orderline.discount 10
25Building Rules
- TypedXmlDocument
- Objects are created based on XPath selectors
Xpath Field represents object property - Other points
- Adding nodes
- XPath editing
26Building RulesForward Chaining
- Policy
- Rule 1
- If A.amount gt 0
- Then B.total A.amount
- Rule 2
- If B.total gt 50 lt 100
- Then B.discount 10
- Rule 3
- If B.total gt 100
- Then B.discount 15
- A.Amount 25
- B.Total 80
- Rule Engine Agenda
- B.Total B.total A.amount
- B.Discount 10
27Building RulesForward Chaining
- Policy
- Rule 1
- If A.amount gt 0
- Then B.total A.amount
- Rule 2
- If B.total gt 50 lt 100
- Then B.discount 10
- Rule 3
- If B.total gt 100
- Then B.discount 15
- A.Amount 25
- B.Total 80 105
- Rule Engine Agenda
- B.Total B.total A.amount
- B.Discount 10
- B.Discount 15
- B.Discount 15
28Building Rules
- Engine Control Functions
- Assert
- Add facts to working memory
- Retracts
- Remove facts from working memory
- RetractByType
- Remove all instances of the specified type
- Update
- Instruct engine to reevaluate relevant
facts/conditions
29Building Rules
- Engine Control Functions
- CreateObject
- Exposed as constructors in Composer
- Halt
- Stop engine processing
- Clear
- Clear facts from memory
- Clear actions from agenda
- Executor
- Handle to the rule engine instance
30Agenda
- Overview of BizTalk Rules Engine(BRE)
- Features
- Building Rules
- Architecture
- Rules Orchestration
- Q A
31Architecture
32Architecture
- Policy Instantiation Get RE Instance
33Architecture
- Policy Instantiation Execute Engine
34Architecture
- Policy Instantiation Get RE Instance
35Demo 3
36Agenda
- Overview of BizTalk Rules Engine(BRE)
- Features
- Building Rules
- Architecture
- Rules Orchestration
- Q A
37Rules and Orchestration
38Rules and Orchestration
39Q A