An Introduction to
   Business Rules with
       JBoss Drools

John Paulett
October 12, 2009
Goals
     Introduction to “business rules”


     High level overview of JBoss Drools


     Discussion of benefits and s...
Business Rules




10/12/2009                    3
Problem Domain
     Basic problem:
             how to model “business logic”


     In this context:
             “busine...
Business Logic Examples
     Rate calculations at insurance company
       ●     Depends on laws, age, sex, location, prev...
Business Rule Engine
     Type of Expert System


     Two types of rules:
       ●     “Production (or Inference) Rules”
...
Forward Chaining
     1) Iterate through antecedents (if …)


     2) Each time an antecedent is matched,
     add knowled...
Rete Algorithm
     Naïve forward chaining does not scale
     well as number of rules increases


     Efficient implemen...
JBoss Drools




10/12/2009                  9
JBoss Drools Suite
     Guvnor – Business Rule Management
     System


     Expert – Production Rules


     Flow – Workf...
Drools Expert
     Core Drools product


     Forward chaining rules with Rete


     Eclipse authoring plugin




10/12/2...
Ways to Write Rules
     Technical Rule Language


     Custom Domain Specific Languages


     Guided Editor


     Decis...
Technical Rule Language

  rule "Hello World"
      when
             m : Message( status == Message.HELLO, myMessage : me...
Custom DSLs
     Map “natural language” into Technical
     Rule Language




10/12/2009                                  ...
Guided Editor




              From http://www.jboss.org/drools/drools-expert.html




10/12/2009                        ...
Decision Table
     Excel XLS based




10/12/2009                     16
Drools Guvnor
     BRMS – Business Rule Management
     System


     Centralized knowledgebase


     Web-based rule auth...
Drools Guvnor
     Manage rules through web console




                 From http://www.jboss.org/drools/drools-guvnor.ht...
Drools Guvnor
     Edit rules through web console




                  From http://www.jboss.org/drools/drools-guvnor.htm...
Drools Flow
     Workflow management




                From http://www.jboss.org/drools/drools-guvnor.html




10/12/200...
Drools Fusion
     Extension to Drools Expert for temporal
     reasoning


     Detects relevant patterns in “cloud or
  ...
Discussion




10/12/2009                22
When To Use a Rules Engine
     Large set of rules, with complex
     branching


     Rules likely to change over time, l...
Benefits
     Separates “business logic” from
     application code


     “Hot” changes of rules (no recompile)


     Im...
Downsides
     New tool
       ●     Learning curve
       ●     Extra point of failure


     Overhead
       ●     Not p...
Alternatives
     Java Rule Engine API - JSR 94


     Closed Source:
       ●     IBM's ILOG JRules, Fair Isaac's Blaze A...
References
     http://www.jboss.org/drools/
     http://java.sun.com/developer/technicalArticles/J2SE/JavaRule.html
     ...
Upcoming SlideShare
Loading in...5
×

Drools

12,729

Published on

Overview of business rules engine with specific details on JBoss's Drools.

Published in: Technology, Education
0 Comments
14 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
12,729
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
660
Comments
0
Likes
14
Embeds 0
No embeds

No notes for slide

Drools

  1. 1. An Introduction to Business Rules with JBoss Drools John Paulett October 12, 2009
  2. 2. Goals Introduction to “business rules” High level overview of JBoss Drools Discussion of benefits and shortcomings 10/12/2009 2
  3. 3. Business Rules 10/12/2009 3
  4. 4. Problem Domain Basic problem: how to model “business logic” In this context: “business logic” ≠ code between UI and DB “business logic” = policies of the business 10/12/2009 4
  5. 5. Business Logic Examples Rate calculations at insurance company ● Depends on laws, age, sex, location, previous history, desired coverage, etc. Critical lab values at hospital ● Depends on age, previous values, other lab tests, diagnose, mandates, etc. 10/12/2009 5
  6. 6. Business Rule Engine Type of Expert System Two types of rules: ● “Production (or Inference) Rules” – If x, then y – Often stateless ● “Reaction Rules” (Complex Event Processing) – Wait for set of events – Stateful 10/12/2009 6
  7. 7. Forward Chaining 1) Iterate through antecedents (if …) 2) Each time an antecedent is matched, add knowledge of consequent (then …) 3) Go to #1, until goal reached 10/12/2009 7
  8. 8. Rete Algorithm Naïve forward chaining does not scale well as number of rules increases Efficient implementation using directed acyclic graph representation of rules Higher memory consumption for increased speed 10/12/2009 8
  9. 9. JBoss Drools 10/12/2009 9
  10. 10. JBoss Drools Suite Guvnor – Business Rule Management System Expert – Production Rules Flow – Workflow Fusion – Complex Event Processing 10/12/2009 10
  11. 11. Drools Expert Core Drools product Forward chaining rules with Rete Eclipse authoring plugin 10/12/2009 11
  12. 12. Ways to Write Rules Technical Rule Language Custom Domain Specific Languages Guided Editor Decision Table 10/12/2009 12
  13. 13. Technical Rule Language rule "Hello World" when m : Message( status == Message.HELLO, myMessage : message ) then System.out.println( myMessage ); m.setMessage( "Goodbye cruel world" ); m.setStatus( Message.GOODBYE ); update( m ); end 10/12/2009 13
  14. 14. Custom DSLs Map “natural language” into Technical Rule Language 10/12/2009 14
  15. 15. Guided Editor From http://www.jboss.org/drools/drools-expert.html 10/12/2009 15
  16. 16. Decision Table Excel XLS based 10/12/2009 16
  17. 17. Drools Guvnor BRMS – Business Rule Management System Centralized knowledgebase Web-based rule authoring Versioning of rules 10/12/2009 17
  18. 18. Drools Guvnor Manage rules through web console From http://www.jboss.org/drools/drools-guvnor.html 10/12/2009 18
  19. 19. Drools Guvnor Edit rules through web console From http://www.jboss.org/drools/drools-guvnor.html 10/12/2009 19
  20. 20. Drools Flow Workflow management From http://www.jboss.org/drools/drools-guvnor.html 10/12/2009 20
  21. 21. Drools Fusion Extension to Drools Expert for temporal reasoning Detects relevant patterns in “cloud or stream of events” 10/12/2009 21
  22. 22. Discussion 10/12/2009 22
  23. 23. When To Use a Rules Engine Large set of rules, with complex branching Rules likely to change over time, likely out of sync with code changes Involve “business users” in creation & maintenance of rules 10/12/2009 23
  24. 24. Benefits Separates “business logic” from application code “Hot” changes of rules (no recompile) Improved performance for large rule sets Communicates rules more clearly than Java code 10/12/2009 24
  25. 25. Downsides New tool ● Learning curve ● Extra point of failure Overhead ● Not practical for small rule sets 10/12/2009 25
  26. 26. Alternatives Java Rule Engine API - JSR 94 Closed Source: ● IBM's ILOG JRules, Fair Isaac's Blaze Advisor Open Source: ● Jess, OpenRules, Zilonis, take 10/12/2009 26
  27. 27. References http://www.jboss.org/drools/ http://java.sun.com/developer/technicalArticles/J2SE/JavaRule.html http://java.sys-con.com/node/45082 http://herzberg.ca.sandia.gov/guidelines.shtml 10/12/2009 27
  1. ¿Le ha llamado la atención una diapositiva en particular?

    Recortar diapositivas es una manera útil de recopilar información importante para consultarla más tarde.

×