2012 02-04 fosdem 2012 - guvnor and j bpm designer

3,161 views

Published on

Presentation over Drools, Guvnor, jBPM and jBPM Designer given by Geoffrey De Smet and Marco Rietveld at FOSDEM 2012.

Published in: Technology
  • Be the first to comment

2012 02-04 fosdem 2012 - guvnor and j bpm designer

  1. 1. Geoffrey De Smet Marco Rietveld Managing workflows and business rules with Guvnor and jBPM designer
  2. 2. Business Logic Integration Business Logic Integration Platform Rule engine Workflow Complex event processing (CEP) Business Rule Management System (BRMS) Automated planning
  3. 3. Geoffrey De Smet Why would I need Drools and Guvnor?
  4. 4. Use cases I have hammer, so every problem is a nail?
  5. 5. The myth <ul><li>Drools is a rule engine
  6. 6. So because </li><ul><li>Drools can fulfil business rules
  7. 7. Drools is Turing complete </li></ul><li>we should write the entire business layer in Drools? </li><ul><li>No!
  8. 8. Not imperative </li><ul><li>Not like Java, Scala, Groovy, ... </li></ul><li>Declarative </li><ul><li>Like RegEx, SQL, JPA-QL, …
  9. 9. Easier to read, better at scaling </li></ul></ul></ul>
  10. 10. When to use Drools <ul><li>Extract business decisions in Drools that either: </li><ul><li>Require schooled domain expertise
  11. 11. Change often/fast </li></ul></ul>
  12. 12. Use cases <ul><li>Financial decisions </li><ul><li>Mortgages acceptance and interest calculation
  13. 13. Insurances acceptance and fee calculation </li></ul></ul>
  14. 14. Use cases <ul><li>Financial decisions </li><ul><li>Mortgages acceptance and interest calculation
  15. 15. Insurances acceptance and fee calculation </li></ul><li>Price calculations </li><ul><li>Phone/Telecom bills </li></ul></ul>
  16. 16. Use cases <ul><li>Financial decisions </li><ul><li>Mortgages acceptance and interest calculation
  17. 17. Insurances acceptance and fee calculation </li></ul><li>Price calculations </li><ul><li>Phone/Telecom bills </li></ul><li>Diagnostics </li><ul><li>Possible diseases based on symptoms </li></ul></ul>
  18. 18. Use cases <ul><li>Financial decisions </li><ul><li>Mortgages acceptance and interest calculation
  19. 19. Insurances acceptance and fee calculation </li></ul><li>Price calculations </li><ul><li>Phone/Telecom bills </li></ul><li>Diagnostics </li><ul><li>Possible diseases based on symptoms </li></ul><li>Complex validation </li><ul><li>Car parts selection </li></ul></ul>
  20. 20. Use cases <ul><li>Financial decisions </li><ul><li>Mortgages acceptance and interest calculation
  21. 21. Insurances acceptance and fee calculation </li></ul><li>Price calculations </li><ul><li>Phone/Telecom bills </li></ul><li>Diagnostics </li><ul><li>Possible diseases based on symptoms </li></ul><li>Complex validation </li><ul><li>Car parts selection </li></ul><li>Not a good use case: an XML parser </li><ul><li>Use Java code for that </li></ul></ul>
  22. 22. Mortgages example
  23. 23. Developers don't like data input from spreadsheets <ul><li>Before App 1.0: Mortgages rules in a spreadsheet </li><ul><li>Which version/copy of the spreadsheet file?
  24. 24. Which field has the result our application needs? </li></ul></ul>Version 1 Version 2
  25. 25. Mortgage experts like the flexibility of spreadsheets <ul><li>Since App 1.0: Mortgages rules in source code </li><ul><li>Changing business rules not flexible enough
  26. 26. Business rules are hard coded in Java </li></ul></ul>Invalid: must be a number
  27. 27. Mortgage experts change their mind a lot <ul><li>Flooded with new improvement requests: </li><ul><li>when income below 500
  28. 28. when income below 1000 and age above 50
  29. 29. when income below 1% of mortgage amount </li></ul></ul>Invalid: must be a number
  30. 30. Mortgage experts like the flexibility of Guvnor <ul><li>App 2.0: Mortgage rules in Guvnor repository </li><ul><li>Flexible like spreadsheet </li><ul><li>But backed by formal DRL and JavaBeans </li></ul><li>No spreadsheet versions/copies </li></ul></ul>
  31. 31. My business requires domain expertise Only mortgage managers understand mortgage rules
  32. 32. Schooled domain expertise <ul><li>Are we, the developers, domain experts? </li><ul><li>Yes, we've been working in this company for year(s). </li></ul></ul>
  33. 33. Schooled domain expertise <ul><li>Are we, the developers, domain experts? </li><ul><li>Yes, we've been working in this company for year(s). </li></ul><li>Do we have </li><ul><li>university's degree in economics? No
  34. 34. participated in mortgages conferences/courses? No
  35. 35. years of mortgage customer experience? No </li></ul></ul>
  36. 36. Schooled domain expertise <ul><li>Are we, the developers, domain experts? </li><ul><li>Yes, we've been working in this company for year(s). </li></ul><li>Do we have </li><ul><li>university's degree in economics? No
  37. 37. participated in mortgages conferences/courses? No
  38. 38. years of mortgage customer experience? No </li></ul><li>Do we have a clue when the mortgage rules need to change? No </li></ul>
  39. 39. Schooled domain expertise <ul><li>Are we, the developers, domain experts? </li><ul><li>Yes, we've been working in this company for year(s). </li></ul><li>Do we have </li><ul><li>university's degree in economics? No
  40. 40. participated in mortgages conferences/courses? No
  41. 41. years of mortgage customer experience? No </li></ul><li>Do we have a clue when the mortgage rules need to change? No
  42. 42. Are we, the developers, domain experts? No </li><ul><li>Mortgage manager is the domain expert </li></ul></ul>
  43. 43. Domain experts can not read/write Java source code <ul><li>Communication problem </li><ul><li>Domain expert can not read it: </li></ul></ul>for (Mortgage m : mortgages ) { for (Applicant a : m.getApplicants()) { if (a.getAge() > 70 ) { boolean existsGuarantor = false ; for (Guarantor g : m.getGuarantors() { if (g.getAge < 60 ) { existsGuarantor = true ; } } // Will they spot the bug in this code? if (existsGuarantor) { m.setApproved( false ); } } } }
  44. 44. Domain experts can read rules in the Guided Rule Editor
  45. 45. Domain experts can write rules in the Guided Rule Editor Change
  46. 46. Translated to DRL Executed on JavaBeans
  47. 47. Guided Rule Editor demo video Demo video
  48. 48. Natural language (DSL) <ul><li>DSL is even easier to read/write </li></ul><ul><li>Developers create the building blocks
  49. 49. Domain experts make the building </li></ul>Source: wikipedia
  50. 50. My business rules change often This mortgage rule change must be released by noon
  51. 51. Deliver changes fast
  52. 52. Deliver changes fast
  53. 53. Deliver changes fast
  54. 54. Business rule change <ul><li>Not a data change </li><ul><li>Requires test and release lifecycle
  55. 55. Logic changes </li></ul><li>Not a software change </li><ul><li>Delivered in hours, not days
  56. 56. Self-service by mortgage manager </li></ul></ul>
  57. 57. Testing before releasing <ul><li>Domain experts need to unit test too </li><ul><li>Example: mortgage of Erik must be disapproved </li></ul></ul>
  58. 58. Releasing <ul><li>Release a snapshot of the rules package
  59. 59. Available at URL: </li><ul><li>http://127.0.0.1:8888/org.drools.guvnor.Guvnor/package/presentationmortgages/mortgagesDeployment </li></ul></ul>
  60. 60. Deployment infrastructure
  61. 61. Auditable and reproducible Why was that mortgage approved last year?
  62. 62. Auditing <ul><li>View old revisions of rules </li></ul>
  63. 63. Summary
  64. 64. Summary <ul><li>Use Drools and Guvnor
  65. 65. When your business decisions either </li><ul><li>Require domain expertise
  66. 66. Change often/fast </li></ul></ul>
  67. 67. Marco Rietveld
  68. 68. How do we keep business analysts from bothering us? Wait, you want A to do D, but not B and C?!?
  69. 69. How do we let business analysts do their work?
  70. 70. The agenda <ul><li>BPM, BPMN 2.0 and jBPM
  71. 71. What does jBPM Designer do?
  72. 72. Demo
  73. 73. Summary </li></ul>
  74. 74. B usiness P rocess M odelling <ul><li>Visibility
  75. 75. Monitoring
  76. 76. High - level </li></ul><ul><li>Continuous improvement
  77. 77. Speed of development
  78. 78. Increased agility </li></ul>A business process is a collection of steps that when executed, accomplish a specific goal. It can often be described using a flow chart.
  79. 79. Flexible and Adaptive Processes Traditional workflow systems have problems with change, complexity, flexibility, data-intensive applications... BPM helps us with: <ul><ul><li>Unstructured, non-linear or flexible processes
  80. 80. Adaptive Case Management </li><ul><li>Data dependent/conditional processes </li></ul><li>Event-driven BPM </li></ul></ul>
  81. 81. BPMN 2.0 <ul><li>OMG specification </li><ul><li>Model
  82. 82. Notation
  83. 83. Execution semantics </li></ul><li>“Understandable” by all business users
  84. 84. Extensible </li></ul>
  85. 85. BPMN 2.0 Example <?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?> <definitions id=&quot;Definition&quot; targetNamespace=&quot;http://www.example.org/MinimalExample&quot; xmlns=&quot;http://www.omg.org/spec/BPMN/20100524/MODEL&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xsi:schemaLocation=&quot;http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd&quot;> <process processType=&quot;Private&quot; isExecutable=&quot;true&quot; id=&quot;ScriptTask&quot; name=&quot;ScriptTask Process&quot; tns:packageName=&quot;com.sample&quot; > <!-- nodes --> <startEvent id=&quot;_1&quot; name=&quot;StartProcess&quot; /> <scriptTask id=&quot;_2&quot; name=&quot;Hello&quot; scriptFormat=&quot;http://www.java.com/java&quot; > <script>System.out.println(&quot;Hello World&quot;);</script> </scriptTask> <endEvent id=&quot;_3&quot; name=&quot;EndProcess&quot; > <terminateEventDefinition/> </endEvent> <!-- connections --> <sequenceFlow id=&quot;_1-_2&quot; sourceRef=&quot;_1&quot; targetRef=&quot;_2&quot; /> <sequenceFlow id=&quot;_2-_3&quot; sourceRef=&quot;_2&quot; targetRef=&quot;_3&quot; /> </process> <bpmndi:BPMNDiagram> <bpmndi:BPMNPlane bpmnElement=&quot;ScriptTask&quot; > <bpmndi:BPMNShape bpmnElement=&quot;_1&quot; > <dc:Bounds x=&quot;16&quot; y=&quot;16&quot; width=&quot;48&quot; height=&quot;48&quot; /> </bpmndi:BPMNShape> <bpmndi:BPMNShape bpmnElement=&quot;_2&quot; > <dc:Bounds x=&quot;96&quot; y=&quot;16&quot; width=&quot;80&quot; height=&quot;48&quot; /> </bpmndi:BPMNShape> <bpmndi:BPMNShape bpmnElement=&quot;_3&quot; > <dc:Bounds x=&quot;208&quot; y=&quot;16&quot; width=&quot;48&quot; height=&quot;48&quot; /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge bpmnElement=&quot;_1-_2&quot; > <di:waypoint x=&quot;40&quot; y=&quot;40&quot; /> <di:waypoint x=&quot;136&quot; y=&quot;40&quot; /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge bpmnElement=&quot;_2-_3&quot; > <di:waypoint x=&quot;136&quot; y=&quot;40&quot; /> ...
  86. 86. So.. we have a way of looking at business processes and a way of specifying them..
  87. 87. jBPM project <ul><li>Open-source business process management </li><ul><li>Embeddable, lightweight Java process engine, supporting native BPMN 2.0 execution
  88. 88. Eclipse-based and web-based editor
  89. 89. Pluggable persistence and transactions (JPA / JTA)
  90. 90. Pluggable human task service based on WS-HumanTask
  91. 91. Management console (process instance management, task lists, task form management, and reporting)
  92. 92. History logging (querying / monitoring / analysis)
  93. 93. Etc.. </li></ul></ul>
  94. 94. jBPM application architecture Core Services Business Analyst End User Developer Rules Core Engine Guvnor Repository Eclipse Editor Web-Based Designer History Log Task Service jBPM Console Your Application Your Services
  95. 95. <ul><li>BPM, BPMN 2.0 and jBPM
  96. 96. What does jBPM Designer do?
  97. 97. Demo
  98. 98. Summary </li></ul>
  99. 99. jBPM 5 Designer <ul><li>Integrated with Guvnor </li><ul><li>Versioning, storage and deployment </li></ul><li>Embeddable (in your own application) </li><ul><li>includes a javascript interface
  100. 100. JSON used for communication </li></ul></ul><ul><li>Targets business users </li><ul><li>Allows users to focus on process creation </li></ul><li>BPMN 2.0 web editor </li><ul><li>Creates fully executable BPMN
  101. 101. Supports the jBPM BPMN subset </li></ul></ul>
  102. 102. jBPM Designer Features 1. Shape repository panel 2. Canvas 3. Properties panel 4. Toolbar 5. Footer 6. Process information
  103. 103. Designer: Shape Menu 1. Connection section 2. Morphing section
  104. 104. Designer: Task Form Generation <ul><li>Automatic generation of forms for human tasks </li><ul><li>Using defined process variables,
  105. 105. human task data I/O parameters and associations
  106. 106. (HTML/Javascript) Source immediately available
  107. 107. Generated forms are stored in Guvnor
  108. 108. All forms are fully usable inside jBPM console
  109. 109. Each form includes basic JavaScript form validation </li></ul></ul>à à
  110. 110. <ul><li>Business analyst stuff
  111. 111. Obligatory introduction to project
  112. 112. Demo!
  113. 113. Summary (AKA The End) </li></ul>
  114. 114. The Slide that you guys look at while I switch to the demo! Bonus: how many (full or partial) circles are on this slide?
  115. 115. Demo: Employee Evaluation <ul><li>1. jbpm-installer </li><ul><li>+ latest version of Designer
  116. 116. + latest version of Guvnor </li></ul><li>2. Start up installer </li><ul><li>(JBoss AS7 + Guvnor + Designer + Console) </li></ul><li>3. Create process in Guvnor/Designer </li><ul><li>Import real process... </li></ul><li>4. Save process
  117. 117. 5. Run process! </li></ul>
  118. 118. Summary
  119. 119. How do we keep them busy? <ul><li>BPM & BPMN 2: Business Process Modelling </li><ul><li>“Go work on the Business Process!” </li></ul><li>jBPM: how to implement an analyst’s work </li><ul><li>Process engine that executes the BPMN </li></ul><li>jBPM Designer: “Look at what you can do!” </li><ul><li>BPMN process creation and modification
  120. 120. Integration with Guvnor: </li><ul><li>Versioning, storage and deployment </li></ul></ul></ul>
  121. 121. Q&A <ul><li>Drools/Guvnor homepage </li><ul><li>http://www.jboss.org/drools </li></ul><li>jBPM homepage </li><ul><li>http://www.jboss.org/jbpm </li></ul><li>Source code: </li><ul><li>http://www.github.com/droolsjbpm
  122. 122. Designer: http://www.github.com/tsurdilo/process-designer </li></ul><li>Download this presentation </li><ul><li>http://www.jboss.org/drools/presentations </li></ul><li>Twitter: @geoffreydesmet & @marcorietveld
  123. 123. Google+: Geoffrey De Smet & Marco Rietveld
  124. 124. IRC: #drools, #droolsdev and #jbpm on Codehaus </li></ul>
  125. 125. Image sources <ul><li>http://images2.visual-paradigm.com/bpva/tutorials/businessprocessmodeling_screenshots/31_complete_bpd.png
  126. 126. http://mainthing.ru/wp-content/uploads/2010/12/battleship-en.png
  127. 127. http://www.slideshare.net/krisverlaenen/jbpm5-argentina-workshop
  128. 128. JBPM online documentation: http://docs.jboss.org/jbpm/v5.2/userguide/ </li></ul>

×