All the cool stuff of JBoss BRMS

  • 4,403 views
Uploaded on

Giovanni Marigi - JBug Roma - January 2012

Giovanni Marigi - JBug Roma - January 2012

More in: Technology , Education
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
4,403
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
157
Comments
0
Likes
4

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. All the cool stuff of JBoss BRMS Giovanni Marigi JBoss Consultant Red Hat, Inc. January 2012 String.class.getName()
  • 2. Agenda
    • What is a BRMS? BRMS features BRMS benefits
    • 3. BRMS - Guvnor
    • 4. BRMS Assets package facts working sets rules decision tables test scenarios other assets
    • 5. JBPM5 processes
    • 6. BRMS authoring
    • 7. Eclipse integration
    • 8. Rule agents
  • 9.
    • What is a BRMS?
    • BRMS (business rules management system) a software where to define and externalize the business and decision logic used inside programs inside an organization
  • 10.
    • What is a BRMS?
    • BRMS a single platform for business modeling JBoss BRMS includes: Expert : Rule Engine Flow/JBPM5 : Rules Process Management Fusion : Complex Event Processing Guvnor : BRMS “front end” and repository for BRMS artifacts JBoss BRMS is distributed: . war archive . already packaged with an EAP . ready for AS7
  • 11.
    • What is a BRMS?
    • Every artifact inside a BRMS is an asset
    • 12. The assets define a knowledge base
    • 13. Business logic is made by several assets: facts (domain model) rules (of course) business processes (workflows) decision tables functions more...
    • 14. Not only business rules!
  • 15.
    • BRMS features
    • Centralized repository of business assets
    • 16. Version control of business assets
    • 17. IDE/User tools to define and to “governance” the decision logic
    • 18. Build, deploy, testing of decision logic
    • 19. Packages of business assets
    • 20. Categorization of business assets
    • 21. Roundtrip, integration with dev Tools (Eclipse)
    • 22. JCR repository (jackrabbit or modeshape) for assets
    • 23. BRMS can be configured for high availabilty
  • 24.
    • BRMS benefits
    • Logic and data separation
    • 25. Cross domain logic
    • 26. Reuse, logic opened to changes
    • 27. Easy to maintain the business logic
    • 28. Changes in live systems
    • 29. Several stakeholders can contribute in defining the business logic (Business Analyst, Rule expert, Developer, Administrators)
  • 30.
    • BRMS - Guvnor
    • Drools Guvnor 5.4.0 Beta1
    • 31. Drools Guvnor 5.3.0 last stable
    • 32. Drools Guvnor 5.3.0 includes: Expert 5.3 (rule engine) Fusion 5.3 (CEP) Flow/JBPM5
    • 33. Eclipse + JBoss Tools
    • BRMS 5.2 last stable
    • 34. BRMS 5.2 includes: - Drools Guvnor 5.2 - Drools Expert 5.2 - Drools Fusion 5.2
    • 35. BRMS 5.3 (next release) will be based on Guvnor 5.3
    • 36. JBoss Developer Studio
    • 37. Bug fixing,patching SLA Enterprise certification | QA
  • 38.
    • BRMS assets - Package
      How to start? define a new package for business assets
    Guvnor Knowledge base
  • 39.
    • BRMS assets: Model/Facts
    • A package must contain a fact model
    • 40. fact model != domain model a fact model typically overlaps a domain model but better to make it decouple from the domain model
    • 41. Rules and assets reason upon a fact model
    • 42. Two ways to do define your fact model: - upload a JAR file containing Java Classes - declare a model within Guvnor
  • 43.
    • BRMS assets: Working Sets
    • Working sets are groups of facts
    • 44. Use them to put constraints on a group of facts and restrict the “reasoning domain” of your business rules
    • 45. Disabled by default
  • 46.
    • BRMS assets: Rules
    • Rules are the “backbone” of a BRMS
    • 47. Don't use a BRMS if you don't have business rules
    • 48. Don't use a BRMS if you don't want or you can't separate logic from data
    • 49. Rules are processed and evaluated by a Rule Engine (Drools Expert)
    • 50. Forward chaining rule engine which implements the RETE algorithm (ReteOO)
    • 51. Rich native language to define rules
    • 52. A rule is contained in a DRL file
    • 53. More info on Drools Expert: Jbug Italy slideshare site: http://www.slideshare.net/jbugrome
  • 54.
    • BRMS assets: Rules
      Forward chaining
      Rule Engine
  • 55.
    • BRMS assets: Rules
    rule "Approve if not rejected" salience -100 agenda-group "approval" when not Rejection() p : Policy(approved == false,policyState:status ) exists Driver(age > 25) Process(status == policyState) then log("APPROVED: due to no objections."); p.setApproved(true); end
    • Anatomy of a rule
    • Example of a rule
  • 56.
    • BRMS assets: Rules
    • Inside BRMS there 4 ways to create a rule: - from scratch,code; can be validated inside BRMS (requires knowledge of Expert) - using the guided editor - uploading a decision table spreadsheet - creating a decision table spreadsheet via the guided editor
  • 57.
    • BRMS assets: Rules
    • Validation of a rule written from scratch
  • 58.
    • BRMS assets: Rules
    • Rules with the guided editor
  • 59.
    • BRMS assets: Decision Tables
    • Express rules with a spreadsheet
    • 60. A spreadsheet can be imported or created via the guided web editor
    • 61. A wizard generator for spreadsheet is available in BRMS!
    • 62. A decision table at runtime is transformed in a series of DRL rules
  • 63.
    • BRMS assets: Test Scenarios
    • Test scenarios are assets used to validate that the rules inside the knowledge base (package) works as expected
    • 64. A scenario is made by a given section (list of facts and its initial state) and an expect section
    • 65. What we can “assert” in a expect section? - Rule Validate that a certain rule fired. - Fact value Validate fact values for a fact created in the Given section. -Any fact that matches Validate that there is at least one fact in the knowledge base with the specified field values.
  • 66.
    • BRMS assets: Test Scenarios
  • 67.
    • BRMS assets: JBPM5
    • A workflow is a process that describes the order in which a series of steps need to be executed, using a flow chart.
    • 68. JBPM5 is based on Drools Flow
    • 69. Workflow guided by rules
    • 70. Rule workflow is the new “generation” of business workflow
    • 71. Rules + workflow: dynamic processes
  • 72.
    • BRMS assets: JBPM5
    • JBPM5 workflow are BPMN2 processes
    • 73. No legacy xml to define the workflow but a standard!
    • 74. Human task (human interaction with a flow) The task service implementation is based on the WS-HumanTask (WS-HT) specification
    • 75. Rule Task: use drools rules inside the flow
    • 76. Pluggable Service Task (work items): nodes with custom logic (e.g. DBControl, EJBControl, EmailControl)
    • 77. Gateway (split,converge) the decision in agateway can be taken by a drools rule!
    • 78. Events (start,end,intermediate)
    • 79. Timers
  • 80.
    • BRMS assets: JBPM5
    • BPMN2 editor in Eclipse
    • 81. BPMN2 editor in BRMS (web editor)
    • 82. BRMS can upload BPMN2 processes designed with other BPMN2 modeling tool
    • 83. Online repository to download ready to use service tasks JBPM Service repository
    • 84. JBPM 3 to 5 migration tool https://github.com/droolsjbpm/jbpmmigration
  • 85.
    • BRMS assets: JBPM5
    • When defined a new work item is available inside Eclipse
  • 86.
    • BRMS assets: JBPM5
    • Web Editor integrated inside BRMS (starting from BRMS 5.3) Available in Guvnor 5.3
  • 87.
    • BRMS other assets
    • Spring context editor to define spring context files;once created they are accessible via HTTP inside the package
    • 88. DSL functions Define rules in a domain specific language
    • 89. Enumeration Enum data to be used in rules
    • 90. Functions
    • 91. Rule templates
  • 92.
    • BRMS authoring
    • Every asset in BRMS is versioned ; every time an asset changes a new version number is attached
    • 93. Assets anyway can't be branched or tagged!
    • 94. An asset contains meta data information
    • 95. Assets can be categorized
    • 96. An asset can be linked to many categories
    • 97. Categories don't have any meaning at runtime; useful to order the assets
    • 98. An asset can have a status (e.g “Draft”, “Completed”); it's a sort of label
  • 99.
    • BRMS authoring
    • A package otherwise is versioned on demand, taking a snapshot for deployment
    • 100. Creating a snapshot means that the BRMS package is ready to be used from external application
    • 101. Before taking a snapshot a build package is required
    • 102. With a build every assets inside the package is validated
    • 103. Status and Categories can be used to select only specific assets to include inside a snapshot (Use selector) (e.g. create a snaposhot only with assets belonging to category “Fraud” and with Status “Completed”)
    • 104. A snapshot will be published inside the repository and accessible via a URL
  • 105.
    • BRMS authoring
  • 106.
    • BRMS Eclipse integration
    • Eclipse can be configured to import the resources (assets) published in BRMS
    • 107. Assets can be edited in Eclipse and committed to BRMS (complete roundtrip)
    • 108. Eclipse gives the capability to compare different version of the same asset
    • 109. Requires JBoss Developer Studio 4.x or Eclipse 3.6.x + JBoss Tools
    • 110. File --> Import --> Guvnor --> Resources from Guvnor
  • 111.
    • BRMS Eclipse integration
  • 112.
    • BRMS Rule Agent
    • How to use a BRMS package inside your application?
    • 113. Create a Drools RuleAgent able to get (download) its KnowledgeBase from BRMS
    • 114. Define a change-set.xml (simple xml file) file where the BRMS packages are listed
    • 115. The KnowledgeBase is the entry point to fire rules, execute bpmn processes,...
  • 116.
    • BRMS Rule Agent
      KnowledgeAgent kagent = KnowledgeAgentFactory.newKnowledgeAgent(&quot;MyAgent&quot;, kaconf); kagent.applyChangeSet( ResourceFactory.newClassPathResource(&quot;change-set.xml&quot;));KnowledgeBase kbase = kagent.getKnowledgeBase(); change.set.xml <?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?> <change-set xmlns=&quot; http://drools.org/drools-5.0/change-set &quot; xmlns:xs=&quot; http://www.w3.org/2001/XMLSchema-instance &quot; xs:schemaLocation=&quot;http://drools.org/drools-5.0/change-set http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-api/src/main/resources/change-set-1.0.0.xsd&quot; > <add> <resource source=&quot;http://localhost:8080/guvnor/org.drools.guvnor.Guvnor/package/JBUG/LATEST&quot; type=&quot;PKG&quot; basicAuthentication=&quot;enabled&quot; username=&quot;uid&quot; password=&quot;pwd&quot;/> </add> </change-set>
  • 117.
    • BRMS Rule Agent
    final StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession(); //insert fact instances in kb ksession.insert(new Car(&quot;AudiA4&quot;,4)); ksession.startProcess(&quot;Process1&quot;); ksession.fireAllRules(); ksession.dispose()
    • What to do with a KnowledgeBase? For example start a process and insert some fact instances to be evaluated inside a process RuleTask
  • 118.
    • BRMS Access BRMS repo
    • BRMS repository can also be accessed - REST API - HTTP (WebClient) - WebDAV
  • 119.
    • BRMS Resources
    • http://www.jboss.org/drools/lists
    • 120. http://www.jboss.org/jbpm/lists
    • 121. IRC server: irc.codehaus.org
    • 122. Channels: #drools #guvnor #jbpm
    THAT'S ALL FOLKS!
  • 123. All the cool stuff of JBoss BRMS THANKS! [email_address]