- 1. BizTalk 2004 Business Rules Engine Todd Sussman Principal
Consultant, BizTalk 2004 MCP Neudesic
2. Agenda
- Background in Business Rules
- Introduction to Microsoft Business Rules Engine
- Calling Rules from a BizTalk Orchestration
3. What are Business Rules?
- Statements that govern conduct of business processes
- Provide separation of rules from application code
- Give business users control of business logic
- Faster response to change
- Lower total cost of application development and ownership
- Todays interest rate =6.5%
- Apply20%discount to all sales, this week only
- If order over$250,000 , send to credit department for
approval
- Business processes stay the same over time, but business rules
are volatile!
Rules Rules Rules Business Rules Engine Rules Rules Rules
Business User Business Process 4. Business Rules(cont)
- Information workers can use rules to:
- Define and own business policies
- Change policies in real time
- No coding or rebuilding required
- Is product low on inventory?
Business Decisions Rules Business Event
- If customer ID exists, then customer is known
- If customer is preferred and quantity exists on shelf, then
product is available
- If customer is not preferred and quantity + 10 exists on shelf,
then product is available
- If quantity on hand < reorder quantity, then product is low
on inventory
- If product is low on inventory, then reorder product
Customer Purchase Order Request 5. Why Should You Use Business
Rules
- Rules engines are becoming mainstream
-
- Gartner says BRE penetration going from 20% - 80% over the next
few years
-
- Using a BRE reduces TCO for an application from 20% - 50% over
the life cycle of the application
- Database triggers and stored procedures are not rule
engines
- You cant share hard-coded rules across applications
6. Gartner BRE MQ Microsoft has a very solid rules engine under
the covers of BizTalk -Gartner Research February 2005 7. A Brief
Introduction to the BRE
-
- Integrated with Microsoft BizTalk Server
-
- Host agnostic for in-proc scenarios
- Powerful tools and framework
-
- Supports developers, information technology administrators, and
information workers
-
- Complete application programming interface (API) for design and
execution
- Rich modeling capabilities
-
- Logical expressions (AND, OR, NOT, and custom)
-
- Data sources: .NET objects, XML, DB
-
- Security, performance, versioning
8. BRE Vocab
- Repository for rules and policies
Rule store
- Invokes policies and submits facts
Rule-based application
- Evaluates condition based on facts and executes actions if
condition evaluates to true
Rule engine
- User-friendly name or string for technical data
Definition
- Contains set of definitions (business-specific
terminology)
Vocabulary
- Functions called when the condition is evaluated to true
Actions
- Data upon which the rule operates
Facts
- Contains predicates applies to facts
Condition
- Contains a condition and a set of actions
Rule
- Logical grouping of rules
Description Term Policy 9. BRE Tools
-
- Develop and deploy policies
- Microsoft Visual Studio .NET
-
- Integrate policies and processes
-
-
- Fact Retrievers long-term facts
- Rule Engine Deployment Wizard
-
- Deploy, export, import policies, and vocabularies
- Health Activity and Tracking (HAT)
-
- Policy execution monitoring
10. BRE Roles
-
- Use business vocabularies
-
- Integrate policies and process
-
- Security, deployment, and migration of policies
- Composer: stand-alone app
- Use policies through InfoPath
- Inside Visual Studio .NET
- Composer: for policy bindings
11. BRE Composer Policies Vocabularies Rule Composer
Definitions
- Create versions of vocabularies
- Create vocabulary definitions
- Publish vocabularies and policies
12. BRE Deployment Wizard
13. BRE Framework
14. Framework is Enterprise Ready
-
- Role-based access to the policies/vocabularies through logical
authorization groups
-
- Latest version or specific version with roll-back
- Rule Engine Update Service
-
- Dynamic updates with configurable caching
- Performance and scalability
-
- Optimized eager-match algorithm for smaller rule sets (RETE)
and Microsoft algorithm for larger rule sets
-
- Scales to large rule sets and fact bases
15. BRE Control Functions
-
- Add facts to working memory
-
- Remove facts from working memory
-
- Remove all instances of the specified type
-
- Instruct engine to reevaluate relevant facts/conditions
-
- Exposed as constructors in Composer
-
- Clear facts from memory and clear actions from agenda
-
- Handle to the rule engine instance
16. Using rules for calculating certainty factor
- Typical scenarios may require finding a risk or certainty
factor for a rule set in a policy
-
- For an insurance policy example, business setup/acquisitions,
bank loans, stock analysis, patient match and more
- You can implement this in an action of each rule
-
- When Rule1 is fired Risk = Risk + 10%
-
- When Rule3 is fired Risk = Risk 15%
-
- When Rule9 is fired Risk = Risk * 2
- .NET components can be leveraged for sophisticated
algorithm
- If final risk > 67% then reject it!
-
- Like loan, acquisition, and more
17. Rules or Orchestration
- Discrete, point-in-time evaluations and calculations
- Large number of permutations to encode in a control flow
- Fact-based inferencing where control flow cannot be
predefined
- Formal workflows that require:
-
- Transactions and compensations
- Known control flow that must be rigorously managed for
performance and scalability
- Visibility and tracking are critical
18. Calling Rules From Orchestration Add reference to rule
engine assembly. Insert a Scope shape and set transactiontype to
atomic. Put Call Rules shape inside the scope. Receive_PO Over
Credit Limit Denied Else ConstructRule Msg Assign { } Atomic Scope
Configure the shape to specify a policy. Call Rules 19. Using Rules
in an Orchestration Call Rules engine to execute logic, instead of
burying it in code. Thats what rules are all about! Call Rules
engine and determine path. Set the field values and use them for
decision making! 20. Using Rules in an Orchestration (cont) Use the
rules engine for dynamic or variable delays. Think of rules as
configuration mechanism! Call Rules engine to dynamically populate
messaging routing information. You can use rules based routing! 21.
Demo 22. Call Business Rules Programmatically
- Add a reference to rule engine assembly
- If using Orchestration, then
-
- Insert Scope shape (atomic)
- Create a Microsoft.RuleEngine.Policy object
- Call Execute method to execute the policy
23. Demo 24. Conclusion
-
- When combined with orchestration technology, enables truly
agile process platformtoday .
-
- Enables business users to fully participate in business
processes.
-
- Increases business performance management platform return on
investment through policy consistency across the organization.