SlideShare a Scribd company logo
JBoss Drools and Drools Fusion (CEP): Making Business Rules react to RTE  Tihomir Surdilovic  [email_address] JBoss, a Division of Red Hat
Agenda Project (Drools) vs. Product (BRMS)
Drools Vision
Drools History
Drools at a glance Expert
Guvnor
JBPM5 Focus on Drools Fusion (CEP Extensions) Event Declaration and Semantics
Event Cloud, Streams and the Session Clock
Temporal Reasoning
Sliding Window Support
Streams Support
Memory Management Questions & Answers
Project vs. Product Repository Rules and Metadata JBoss Enterprise BRMS Platform JBoss Rules Rules Engine/ Execution Rules Development & Management CEP Complex Events Jboss EWP
Project vs. Product Cont. Stand-alone Framework
Innovation
Fast and Frequent Releases
Tested on developer environments
Suitable for development and prototype
No Patches – On to next big thing
Non SLA bound forum support Fully Integrated Platform
Same Innovated Code + Stability
Stability – Includes usability, performance and security issues identified during productization
Certified for Multi-OS, Multi-DB
Best for Development and Production
5 Yr lifecycle – Includes patches, updates, backward compatibility
SLA based full support from dedicated support engineers
Open Source Assurance – legal protection derived
Jboss community and Enterprise  Changes Community / Enterprise Platform Delta BRMS Drools Enterprise Platforms - Performance, Scalability, Security and Quality improves over time without  compromising long-term compatibility.  08/09 12/10 03/11 05/11  Over 150+ defect fixes & 35+ OS/JVM/DB certifications (& counting) between Drools Community 5.1 & JBoss BRMS 5.1.x
Evolution of Jboss BRMS 05/08   04/09   12/10   ?  Lightweight Business Rules Engine Business Rules Engine
Authoring and Management App
Repository
EAP Certified
DBs, JVMs  Business Rules Engine
Authoring and Management App
Choice of Repository
Integrated Container
CEP – Tech Preview
EAP, EWS, EWP, JVMs, Dbs and more
Performance Repository JBoss Enterprise BRMS Platform 5.0 JBoss Rules BRM Repository JBoss Enterprise BRMS Platform 5.1 JBoss Rules BRM CEP Jboss EWP
“ A  common platform  to  model  and  govern  the business  logic  of the enterprise.” Drools Vision
Drools Vision Cont. Event Processes Semantic  Ontologies Workflows Rules Rules  Workflows Event Processes Semantic  Ontologies
Drools History – Business Rule Engines 1980s 2010s 1990s 2000s OPS5 ART Clips Jess Drools 2 JRules Drools 3 Drools 4 Drools 5
Drools History Drools 2 Rete like XML Scripting language Drools 3  Based on Clips functionality
Iterative improves to JRules syntax with Clips functionality Drools 4 More declarative
Basic functional programming feature with “from”
Basic Rule Flow
Basic BRMS Drools 5 Improved functional programming with 'accumulate'
More Advanced Rule Flow integration
Complex Event Process Temporal Comparators
Sliding Time Windows Production ready BRMS (Guvnor)
Drools History Cont. Drools 5.1 Differential Diff (true modify) Drools 5.2 (this month, 5.2.0.CR1 available for download) Freeform expressions between patterns
Multi-function accumulates
Prolog like derivation queries
Decision tables and rule templates (Guvnor)
Pure GWT (Guvnor)
Sample Industries and Users Investment Millennium Investment Group (MIG)   Logistics Fedex   Airline Sabre Mortgage Franklin American Healthcare OSDE
Drools at a glance - Declarative programming Production Rule Systems PRD (forward chaining) Reactive
when Alarm( status == “alert” )  then send( “warning” ) Logic Programming LP (backward chaining) Query
descendant( “mary”, “jane”) Functional Programming FP Map,Fold, Filter
avg([12, 16, 4, 6]) Returns single value 9.5 round([10.3, 4.7, 7.8] ) Returns List [10, 5, 8] Description Logic (model concepts, roles, and individuals) Person Has Name and    lives at Address
Drools Expert at a glance – Example A - SQL comparison example select * from  Account acc,  Cashflow cf, AccountPeriod ap where acc.accountNo ==  cf.accountNo and cf.type == CREDIT  cf.date >= ap.start and cf.date <= ap.end trigger : acc.balance += cf.amount rule “increase balance for AccountPeriod Credits” when ap : AccountPeriod() acc : Account( $accountNo : accountNo )  CashFlow( type == CREDIT, accountNo == $accountNo, date >= ap.start && <= ap.end, $ammount : ammount ) then acc.balance  += $amount;  end
Drools Expert at a glance –  Rules as a view rule “increase balance for AccountPeriod  Credits” when ap : AccountPeriod() acc : Account( $accountNo : accountNo )  CashFlow( type == CREDIT, accountNo == $accountNo, date >= ap.start && <= ap.end, $ammount : ammount ) then acc.balance  += $amount;  end rule “decrease balance for AccountPeriod  Debits” when ap : AccountPeriod() acc : Account( $accountNo : accountNo )  CashFlow( type == DEBIT, accountNo == $accountNo, date >= ap.start && <= ap.end, $ammount : ammount ) then acc.balance  -= $amount;  end
Drools Expert at a glance – Example A - Building and executing rules
Drools Expert at a glance – Example A Building and executing rules cont. Building Executing
Drools Expert at a glance – Example B - Building and executing rules
Drools Expert at a glance – Example B cont. No Fires Add some  Fires
Drools Expert at a glance – Example B cont. Fires are put out after a while
Drools Expert at a glance – Conditional Elements
Drools Expert at a glance – Accumulate CE Bus Example Accumulate general syntax Bus Example Revisited (no accumulate functions)
Drools Expert at a glance – Conditional Elements From
Drools Expert at a glance – Timers and Calendars Interval Timers Field Name   Mandatory?    Allowed Values    Allowed Special Characters Seconds    YES    0-59    , - * / Minutes    YES    0-59    , - * / Hours    YES    0-23    , - * / Day of month  YES    1-31    , - * ? / L W Month    YES    1-12 or JAN-DEC    , - * / Day of week    YES    1-7 or SUN-SAT    , - * ? / L # Year    NO    empty, 1970-2099    , - * /  Cron-based Timers
Drools Expert at a glance – Timers and Calendars Calendars Using Timers and Calendars together Execute now and after  1 hour duration on week days Execute now and after  4 hour duration on weekend days
Drools Expert at a glance – Truth maintenance and Inference Issuing Buss passes – typical rule implementation Good practice to do: De-couple knowledge responsibilities
Encapsulate knowledge
Provide semantic abstractions for those encapsulation
Integrity robustness – truth maintenance These types of implementations are considered Bad
Monolithic
Leaky

More Related Content

PPT
Biz Talk Demo slideshare
PDF
Microsoft SQL Server Query Tuning
PDF
EM12c: Capacity Planning with OEM Metrics
PPTX
Performance Management in Oracle 12c
PDF
Collaborate 2019 - How to Understand an AWR Report
PDF
My Experience Using Oracle SQL Plan Baselines 11g/12c
PDF
Oracle Enterprise Manager Cloud Control 13c for DBAs
PDF
Oracle Enterprise Manager 12c - OEM12c Presentation
Biz Talk Demo slideshare
Microsoft SQL Server Query Tuning
EM12c: Capacity Planning with OEM Metrics
Performance Management in Oracle 12c
Collaborate 2019 - How to Understand an AWR Report
My Experience Using Oracle SQL Plan Baselines 11g/12c
Oracle Enterprise Manager Cloud Control 13c for DBAs
Oracle Enterprise Manager 12c - OEM12c Presentation

What's hot (20)

PDF
Aioug vizag oracle12c_new_features
PDF
Simplifying EBS 12.2 ADOP - Collaborate 2019
PPTX
Oracle Oracle Performance Tuning
PPT
OOUG - Oracle Performance Tuning with AAS
PDF
Exploring Oracle Database Performance Tuning Best Practices for DBAs and Deve...
PPTX
SOA_BPM_12c_launch_event_BPM_track_business_rules_marcelvdglind
PDF
SafePeak whitepaper
PPTX
Optimizing Alert Monitoring with Oracle Enterprise Manager
PDF
Exadata MAA Best Practices
PDF
Oracle db performance tuning
PDF
Safe peak installation guide version 2.1
PPT
Sql server performance tuning
PPTX
Foundation for optimized data center & private cloud
PPT
EM12c Monitoring, Metric Extensions and Performance Pages
PPTX
Ten query tuning techniques every SQL Server programmer should know
PDF
Oracle - Enterprise Manager 12c Overview
PDF
Oracle Enterprise Manager 11g
PDF
Oracle Enterprise Manager Cloud Control 13c for DBAs
PDF
Oracle Performance Tuning Fundamentals
PDF
Oracle database performance tuning
Aioug vizag oracle12c_new_features
Simplifying EBS 12.2 ADOP - Collaborate 2019
Oracle Oracle Performance Tuning
OOUG - Oracle Performance Tuning with AAS
Exploring Oracle Database Performance Tuning Best Practices for DBAs and Deve...
SOA_BPM_12c_launch_event_BPM_track_business_rules_marcelvdglind
SafePeak whitepaper
Optimizing Alert Monitoring with Oracle Enterprise Manager
Exadata MAA Best Practices
Oracle db performance tuning
Safe peak installation guide version 2.1
Sql server performance tuning
Foundation for optimized data center & private cloud
EM12c Monitoring, Metric Extensions and Performance Pages
Ten query tuning techniques every SQL Server programmer should know
Oracle - Enterprise Manager 12c Overview
Oracle Enterprise Manager 11g
Oracle Enterprise Manager Cloud Control 13c for DBAs
Oracle Performance Tuning Fundamentals
Oracle database performance tuning
Ad

Viewers also liked (20)

PDF
Digital in store - point de vente proximite - Retail and Detail Solutions
PPTX
March 9 Focus Fusion NYC presentation
PPTX
Comparison of image fusion methods
PDF
Implementing Fusion Cloud Procurement a Real Life Case Study
PDF
90 Minute Introduction to the Fusion Theming Framework for Drupal
PDF
Oracle Fusion applications 101 [2010 OAUG Collaborate]
PDF
La structuration d'un EPIC Creuse Grand Sud Aubusson Felletin - Rencontre rés...
PPTX
Analysis of Jones Lang Lasalle (JLL) financial statements
PDF
Lattice Energy LLC - Synopsis of book titled Fusion Fiasco by Steven Krivit p...
PDF
Baromètre Web-to-Store Mappy
PDF
Analyzing Fusion Genes Using Next-Generation Sequencing
PPT
Oracle Fusion Applications Accounts Payables
PPTX
Age estimation by bones
PDF
Cold fusion, Tesla, Scalar wave, Torsion field, "Free energy", Zeropoint Ener...
PPT
Oracle Fusion Development, May 2009
PDF
Liste des marchés étrangers reconnus en france
PPT
Retrospective 2015
PDF
Kall Fusion, Tesla, Skalära Vågor, Torsion Fält, Fri Energi = Pseudovetenskap...
PPTX
Fusion, Acquisition - Optimisez la migration et la continuité des outils col...
PPTX
Protoplast fusion
Digital in store - point de vente proximite - Retail and Detail Solutions
March 9 Focus Fusion NYC presentation
Comparison of image fusion methods
Implementing Fusion Cloud Procurement a Real Life Case Study
90 Minute Introduction to the Fusion Theming Framework for Drupal
Oracle Fusion applications 101 [2010 OAUG Collaborate]
La structuration d'un EPIC Creuse Grand Sud Aubusson Felletin - Rencontre rés...
Analysis of Jones Lang Lasalle (JLL) financial statements
Lattice Energy LLC - Synopsis of book titled Fusion Fiasco by Steven Krivit p...
Baromètre Web-to-Store Mappy
Analyzing Fusion Genes Using Next-Generation Sequencing
Oracle Fusion Applications Accounts Payables
Age estimation by bones
Cold fusion, Tesla, Scalar wave, Torsion field, "Free energy", Zeropoint Ener...
Oracle Fusion Development, May 2009
Liste des marchés étrangers reconnus en france
Retrospective 2015
Kall Fusion, Tesla, Skalära Vågor, Torsion Fält, Fri Energi = Pseudovetenskap...
Fusion, Acquisition - Optimisez la migration et la continuité des outils col...
Protoplast fusion
Ad

Similar to JBoss Drools and Drools Fusion (CEP): Making Business Rules react to RTE (20)

ODP
Drools & jBPM Info Sheet
ODP
Buenos Aires Drools Expert Presentation
ODP
2011-03-29 London - drools
PDF
Drools JBoss Rules 5 0 developer s guide develop rules based business logic u...
ODP
Drooling for drools (JBoss webex)
PDF
Introducing Drools
ODP
2012 02-04 fosdem 2012 - guvnor and j bpm designer
ODP
JBoss World 2011 - Drools
ODP
JBoss BRMS - The enterprise platform for business logic
ODP
All the cool stuff of JBoss BRMS
ODP
Drools New York City workshop 2011
PDF
Intro to Drools - St Louis Gateway JUG
PDF
Drools, jBPM and OptaPlanner (NYC and DC Sept 2017 - Keynote Talk Video)
ODP
Developing applications with rules, workflow and event processing (it@cork 2010)
PDF
Drools
PPTX
JBoss Drools - Pure Java Rule Engine
ODP
Business processes, business rules, complex event processing, the JBoss way
PPTX
Jboss jbpm and drools 1 introduction to drools architecture
PDF
Rules Programming tutorial
PDF
Drools5 Community Training Module#1: Drools5 BLiP Introduction
Drools & jBPM Info Sheet
Buenos Aires Drools Expert Presentation
2011-03-29 London - drools
Drools JBoss Rules 5 0 developer s guide develop rules based business logic u...
Drooling for drools (JBoss webex)
Introducing Drools
2012 02-04 fosdem 2012 - guvnor and j bpm designer
JBoss World 2011 - Drools
JBoss BRMS - The enterprise platform for business logic
All the cool stuff of JBoss BRMS
Drools New York City workshop 2011
Intro to Drools - St Louis Gateway JUG
Drools, jBPM and OptaPlanner (NYC and DC Sept 2017 - Keynote Talk Video)
Developing applications with rules, workflow and event processing (it@cork 2010)
Drools
JBoss Drools - Pure Java Rule Engine
Business processes, business rules, complex event processing, the JBoss way
Jboss jbpm and drools 1 introduction to drools architecture
Rules Programming tutorial
Drools5 Community Training Module#1: Drools5 BLiP Introduction

Recently uploaded (20)

PPTX
MYSQL Presentation for SQL database connectivity
PDF
Approach and Philosophy of On baking technology
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPT
Teaching material agriculture food technology
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Machine learning based COVID-19 study performance prediction
PDF
Chapter 3 Spatial Domain Image Processing.pdf
DOCX
The AUB Centre for AI in Media Proposal.docx
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
cuic standard and advanced reporting.pdf
PPTX
Big Data Technologies - Introduction.pptx
PPTX
Cloud computing and distributed systems.
MYSQL Presentation for SQL database connectivity
Approach and Philosophy of On baking technology
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Teaching material agriculture food technology
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Encapsulation_ Review paper, used for researhc scholars
20250228 LYD VKU AI Blended-Learning.pptx
Machine learning based COVID-19 study performance prediction
Chapter 3 Spatial Domain Image Processing.pdf
The AUB Centre for AI in Media Proposal.docx
Understanding_Digital_Forensics_Presentation.pptx
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
MIND Revenue Release Quarter 2 2025 Press Release
Mobile App Security Testing_ A Comprehensive Guide.pdf
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
cuic standard and advanced reporting.pdf
Big Data Technologies - Introduction.pptx
Cloud computing and distributed systems.

JBoss Drools and Drools Fusion (CEP): Making Business Rules react to RTE

  • 1. JBoss Drools and Drools Fusion (CEP): Making Business Rules react to RTE Tihomir Surdilovic [email_address] JBoss, a Division of Red Hat
  • 2. Agenda Project (Drools) vs. Product (BRMS)
  • 5. Drools at a glance Expert
  • 7. JBPM5 Focus on Drools Fusion (CEP Extensions) Event Declaration and Semantics
  • 8. Event Cloud, Streams and the Session Clock
  • 13. Project vs. Product Repository Rules and Metadata JBoss Enterprise BRMS Platform JBoss Rules Rules Engine/ Execution Rules Development & Management CEP Complex Events Jboss EWP
  • 14. Project vs. Product Cont. Stand-alone Framework
  • 16. Fast and Frequent Releases
  • 17. Tested on developer environments
  • 18. Suitable for development and prototype
  • 19. No Patches – On to next big thing
  • 20. Non SLA bound forum support Fully Integrated Platform
  • 21. Same Innovated Code + Stability
  • 22. Stability – Includes usability, performance and security issues identified during productization
  • 24. Best for Development and Production
  • 25. 5 Yr lifecycle – Includes patches, updates, backward compatibility
  • 26. SLA based full support from dedicated support engineers
  • 27. Open Source Assurance – legal protection derived
  • 28. Jboss community and Enterprise Changes Community / Enterprise Platform Delta BRMS Drools Enterprise Platforms - Performance, Scalability, Security and Quality improves over time without compromising long-term compatibility. 08/09 12/10 03/11 05/11 Over 150+ defect fixes & 35+ OS/JVM/DB certifications (& counting) between Drools Community 5.1 & JBoss BRMS 5.1.x
  • 29. Evolution of Jboss BRMS 05/08 04/09 12/10 ? Lightweight Business Rules Engine Business Rules Engine
  • 33. DBs, JVMs Business Rules Engine
  • 37. CEP – Tech Preview
  • 38. EAP, EWS, EWP, JVMs, Dbs and more
  • 39. Performance Repository JBoss Enterprise BRMS Platform 5.0 JBoss Rules BRM Repository JBoss Enterprise BRMS Platform 5.1 JBoss Rules BRM CEP Jboss EWP
  • 40. “ A common platform to model and govern the business logic of the enterprise.” Drools Vision
  • 41. Drools Vision Cont. Event Processes Semantic Ontologies Workflows Rules Rules Workflows Event Processes Semantic Ontologies
  • 42. Drools History – Business Rule Engines 1980s 2010s 1990s 2000s OPS5 ART Clips Jess Drools 2 JRules Drools 3 Drools 4 Drools 5
  • 43. Drools History Drools 2 Rete like XML Scripting language Drools 3 Based on Clips functionality
  • 44. Iterative improves to JRules syntax with Clips functionality Drools 4 More declarative
  • 45. Basic functional programming feature with “from”
  • 47. Basic BRMS Drools 5 Improved functional programming with 'accumulate'
  • 48. More Advanced Rule Flow integration
  • 49. Complex Event Process Temporal Comparators
  • 50. Sliding Time Windows Production ready BRMS (Guvnor)
  • 51. Drools History Cont. Drools 5.1 Differential Diff (true modify) Drools 5.2 (this month, 5.2.0.CR1 available for download) Freeform expressions between patterns
  • 54. Decision tables and rule templates (Guvnor)
  • 56. Sample Industries and Users Investment Millennium Investment Group (MIG) Logistics Fedex Airline Sabre Mortgage Franklin American Healthcare OSDE
  • 57. Drools at a glance - Declarative programming Production Rule Systems PRD (forward chaining) Reactive
  • 58. when Alarm( status == “alert” ) then send( “warning” ) Logic Programming LP (backward chaining) Query
  • 59. descendant( “mary”, “jane”) Functional Programming FP Map,Fold, Filter
  • 60. avg([12, 16, 4, 6]) Returns single value 9.5 round([10.3, 4.7, 7.8] ) Returns List [10, 5, 8] Description Logic (model concepts, roles, and individuals) Person Has Name and lives at Address
  • 61. Drools Expert at a glance – Example A - SQL comparison example select * from Account acc, Cashflow cf, AccountPeriod ap where acc.accountNo == cf.accountNo and cf.type == CREDIT cf.date >= ap.start and cf.date <= ap.end trigger : acc.balance += cf.amount rule “increase balance for AccountPeriod Credits” when ap : AccountPeriod() acc : Account( $accountNo : accountNo ) CashFlow( type == CREDIT, accountNo == $accountNo, date >= ap.start && <= ap.end, $ammount : ammount ) then acc.balance += $amount; end
  • 62. Drools Expert at a glance – Rules as a view rule “increase balance for AccountPeriod Credits” when ap : AccountPeriod() acc : Account( $accountNo : accountNo ) CashFlow( type == CREDIT, accountNo == $accountNo, date >= ap.start && <= ap.end, $ammount : ammount ) then acc.balance += $amount; end rule “decrease balance for AccountPeriod Debits” when ap : AccountPeriod() acc : Account( $accountNo : accountNo ) CashFlow( type == DEBIT, accountNo == $accountNo, date >= ap.start && <= ap.end, $ammount : ammount ) then acc.balance -= $amount; end
  • 63. Drools Expert at a glance – Example A - Building and executing rules
  • 64. Drools Expert at a glance – Example A Building and executing rules cont. Building Executing
  • 65. Drools Expert at a glance – Example B - Building and executing rules
  • 66. Drools Expert at a glance – Example B cont. No Fires Add some Fires
  • 67. Drools Expert at a glance – Example B cont. Fires are put out after a while
  • 68. Drools Expert at a glance – Conditional Elements
  • 69. Drools Expert at a glance – Accumulate CE Bus Example Accumulate general syntax Bus Example Revisited (no accumulate functions)
  • 70. Drools Expert at a glance – Conditional Elements From
  • 71. Drools Expert at a glance – Timers and Calendars Interval Timers Field Name Mandatory? Allowed Values Allowed Special Characters Seconds YES 0-59 , - * / Minutes YES 0-59 , - * / Hours YES 0-23 , - * / Day of month YES 1-31 , - * ? / L W Month YES 1-12 or JAN-DEC , - * / Day of week YES 1-7 or SUN-SAT , - * ? / L # Year NO empty, 1970-2099 , - * / Cron-based Timers
  • 72. Drools Expert at a glance – Timers and Calendars Calendars Using Timers and Calendars together Execute now and after 1 hour duration on week days Execute now and after 4 hour duration on weekend days
  • 73. Drools Expert at a glance – Truth maintenance and Inference Issuing Buss passes – typical rule implementation Good practice to do: De-couple knowledge responsibilities
  • 75. Provide semantic abstractions for those encapsulation
  • 76. Integrity robustness – truth maintenance These types of implementations are considered Bad
  • 78. Leaky
  • 79. Brittle integrity - manual maintenance Couples the logic What happens when the Child becomes 16?
  • 80. Drools Expert at a glance – Truth maintenance and Inference cont. De-coupling knowledge responsibilities De-couples the logic Maintains the truth by automatically retracting. Rule “logically” inserts an object. When the rule is no longer true, the object is retracted. The truth maintenance cascades
  • 81. Drools Expert at a glance – Truth maintenance and Inference cont. Notification upon automatic fact retraction Executing The truth maintenance cascades
  • 82. Drools Expert at a glance – Roadmap Improved backward chaining (open queries)
  • 88. Runtime Management BAM (Business Activity Monitoring)
  • 89. Drools Guvnor at a glance Technology JCR 2.0 (JSR-170) backend
  • 90. Seam 2 + GWT frontend
  • 93. Role based security Authoring Decision Tables
  • 94. Guided Editor QA Scenario Testing + Rule Verification
  • 95. Drools Guvnor at a glance – Business asset storage
  • 96. Drools Guvnor at a glance – Guided Editor
  • 97. Drools Guvnor at a glance – Decision Tables
  • 98. Drools Guvnor at a glance – Scenario Testing
  • 99. Drools Guvnor at a glance – BPMN2 processes
  • 100. Drools Guvnor at a glance – Compiling and exposing rule packages
  • 101. jBPM5 at a glance – What is BPM? Business Process Management A business process is a process that describes the order in which a series of steps need to be executed, using a flow chart.
  • 102. jBPM5 at a glance – Why BPM? Visibility
  • 107. jBPM5 at a glance – Key Characteristics Open-source business process management project offering: generic process engine supporting native BPMN 2.0 execution
  • 108. targeting developers and business users
  • 109. collaboration, management and monitoring using web-based consoles
  • 110. powerful rules and event integration Core engine is a workflow engine in pure Java state transitions
  • 114. jBPM5 at a glance – Core Engine // (1) Create knowledge base and add process definition KnowledgeBuilder kbuilder = ... kbuilder.add( ..., &quot;sample.bpmn&quot;, ResourceType.BPMN2); KnowledgeBase kbase = kbuilder.newKnowledgeBase(); kbase.addKnowledgePackages(kbuilder.getKnowledgePackages()); // (2) Create new stateful knowledge session StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession(); // (3) Start a new process instance ksession.startProcess(“com.sample.bpmn.hello”); Knowledge Base Stateful Knowledge Session Process Definition Process Instance
  • 115. jBPM5 at a glance – BPMN 2.0 OMG specification Model
  • 117. Execution semantics Understandable by all business users
  • 119. Extensible < definitions ... > < process id=&quot;com.sample.bpmn.hello&quot; name=&quot;Hello World&quot; > < startEvent id=&quot;_1&quot; name=&quot;StartProcess&quot; /> < sequenceFlow sourceRef=&quot;_1&quot; targetRef=&quot;_2&quot; /> < scriptTask id=&quot;_2&quot; name=&quot;Hello&quot; > < script >System.out.println(&quot;Hello World&quot;);</ script > </ scriptTask > < sequenceFlow sourceRef=&quot;_2&quot; targetRef=&quot;_3&quot; /> < endEvent id=&quot;_3&quot; name=&quot;EndProcess&quot; /> </ process > </ definitions > Core Engine BPMN 2.0 XML
  • 120. jBPM5 at a glance – Persistence and Transactions Persistence (JPA, pluggable) Runtime persistence
  • 122. Services Transactions (JTA, pluggable) Command-scoped
  • 123. User-defined Core Engine BPMN 2.0 XML Persistence Trans- actions JPA JTA
  • 124. jBPM5 at a glance – Console Web-based management
  • 127. User task lists / forms
  • 128. Reporting Core Engine BPMN 2.0 XML Persistence Trans- actions Events History Log Management Console BAM
  • 129. jBPM5 at a glance – Console Domain-specific Processes: Extend palette with
  • 131. service nodes define input / output parameters
  • 133. Human task service (WS-HT) Task lists
  • 134. Task life cycle Task clients Task forms Core Engine BPMN 2.0 XML Persistence Trans- actions Events Integration Domain-specific Processes Human Task Service ESB
  • 135. jBPM5 at a glance – Roadmap jBPM 5.0: February 2011
  • 136. jBPM 5.1: NOW ... Improve Oryx BPMN2 designer to support full round-tripping
  • 137. New Eclipse BPMN2 editor
  • 138. Lots of small feature improvements and bug fixes jBPM 5.2 – jBPM 6.x Simulation / testing / replay
  • 140. Integrated “no-code” tooling (form builder, etc.)
  • 141. Focus on Drools Fusion (CEP) Brief introduction on CEP and Terminology
  • 143. Drools Fusion: Complex Event Processing extensions Event Declaration and Semantics
  • 144. Event Cloud, Streams and the Session Clock
  • 149. Drools Fusion – What is an Event? “ An event is an observable occurrence .”
  • 150. “ An event in the Unified Modelling Language is a notable occurrence at a particular point in time .”
  • 152. “ Anything that happens , or is contemplated as happening .”
  • 153. “ An object that represents, encodes or records an event , generally for the purpose of computer processing ”
  • 154. http://complexevents.com For the scope of this presentation:
  • 155. “ An event is a significant change of state at a particular point in time ”
  • 156. Drools Fusion – What is a Complex Event? “ Complex Event , is an abstraction of other events called its members.” Examples : The 1929 stock market crash – an abstraction denoting many thousands of member events, including individual stock trades)
  • 157. The 2004 Indonesian Tsunami – an abstraction of many natural events
  • 158. A completed stock purchase -an abstraction of the events in a transaction to purchase the stock
  • 159. A successful on-line shopping cart checkout – an abstraction of shopping cart events on an on-line website Source: http://complexevents.com
  • 160. Drools Fusion – What is Complex Event Processing (CEP)? “ Complex Event Processing , or CEP, is primarily an event processing concept that deals with the task of processing multiple events with the goal of identifying the meaningful events within the event cloud.
  • 161. CEP employs techniques such as detection of complex patterns of many events, event correlation and abstraction , event hierarchies, and relationships between events such as causality, membership, and timing, and event-driven processes.”
  • 163. Drools Fusion – CEP Scenarios Examples: Emergency Response Systems
  • 164. Credit Card Fraud Detection
  • 166. Neonatal ICU: infant vital signs monitoring A few characteristics of common CEP scenarios: Huge volume of events, but only a few of real interest Usually events are immutable
  • 167. Usually queries/rules have to run in reactive mode
  • 168. Strong temporal relationships between events Individual events are usually not important The composition and aggregation of events is important
  • 169. Drools Fusion – CEP vs. ESP Complex Event Processing , or CEP, and Event Stream Processing , or ESP, are two technologies that were born separate, but converged . An oversimplification : In their origins... Event Stream Processing focused on the ability to process high volume streams of events.
  • 170. Complex Event Processing focused on defining, detecting and processing the relationships among events. For the scope of this presentation:
  • 171. “ CEP is used as a common term meaning both CEP and ESP .”
  • 172. Drools Fusion – EDA “ Event Driven Architecture (EDA) is a software architecture pattern promoting the production , detection , consumption of, and reaction to events. An event can be defined as &quot;a significant change in state&quot;[1]. For example, when a consumer purchases a car, the car's state changes from &quot;for sale&quot; to &quot;sold&quot;. A car dealer's system architecture may treat this state change as an event to be produced, published, detected and consumed by various applications within the architecture.” http://en.wikipedia.org/wiki/Event_Driven_Architecture CEP is a component of the EDA
  • 173. Drools Fusion – EDA vs SOA EDA is **not** SOA 2.0
  • 175. Metaphor In our body : SOA is used to build our muscles and organs (what's needed to DO things)
  • 176. EDA is used to build our sensory system (what's needed to REACT TO things)
  • 177. Drools Fusion – CEP Characteristics A few characteristics of common CEP scenarios: Huge volume of events, but only a few of real interest Usually events are immutable
  • 178. Usually queries/rules have to run in reactive mode
  • 179. Strong temporal relationships between events Individual events are usually not important The composition and aggregation of events is important
  • 180. Drools Fusion – Enables... Event Detection: From an event cloud or set of streams, select all the meaningful events, and only them. [Temporal] Event Correlation: Ability to correlate events and facts declaring both temporal and non-temporal constraints between them.
  • 181. Ability to reason over event aggregation Event Abstraction: Ability to compose complex events from atomic events AND reason over them
  • 182. Drools Fusion – Features Features: Event Semantics as First Class Citizens
  • 183. Allow Detection, Correlation and Composition
  • 191. Drools Fusion – Demo Twitter Stream CEP Demo: Listen to the Twitter Stream API Twitter4J API
  • 192. Listens to a random sample of tweets Detects patterns and reacts Drools Fusion Simple one process (multi-thread) demo Focus on specific features
  • 193. Drools Fusion – Event Declaration and Semantics Event semantics: Point-in-time and Interval An event is a fact with a few special characteristics: Usually immutable , but not enforced
  • 194. Strong temporal relationships Lifecycle may be managed Allow use of sliding windows “ All events are facts , but not all facts are events.”
  • 195. Demo twitter rules part 1, 2, 3) // declaring existing class import some.package.VoiceCall declare VoiceCall @role ( event ) @timestamp ( calltime ) @duration ( duration ) end // generating an event class declare StockTick @role ( event ) symbol : String price : double end
  • 196. Drools Fusion – Temporal Reasoning Semantics for: time: discrete
  • 197. events: point-in-time and interval Ability to express temporal relationships: Allen’s 13 temporal operators James F. Allen defined the 13 possible temporal relations between two events.
  • 198. Eiko Yoneki and Jean Bacon defined a unified semantics for event correlation over time and space.
  • 199. Drools Fusion – Temporal Relationships rule “Shipment not picked up in time” when Shipment ( $pickupTime : scheduledPickupTime ) not ShipmentPickup ( this before $pickupTime ) then // shipment not picked up... Action required. end Temporal Relationship
  • 200. Drools Fusion – Allen’s 13 Temporal Operators Point-Point Point-Interval Interval-Interval A before B A meets B A overlaps B A finishes B A includes B A starts B A coincides B A B A B A B A B A B A B A B
  • 201. Drools Fusion – Allen’s 13 Temporal Operators Point-Point Point-Interval Interval-Interval A after B A metBy B A overlapedBy B A finishedBy B A during B A finishes B Demo twitter rules part 4 A B A B A B A B A B A B
  • 202. Drools Fusion – Streams : Simple Example Scenario
  • 203. Drools Fusion – Stream Support (entry-points) A scoping abstraction for stream support Rule compiler gather all entry-point declarations and expose them through the session API
  • 204. Engine manages all the scoping and synchronization behind the scenes. rule “Stock Trade Correlation” when
  • 205. $c : Customer( type == “VIP” )
  • 206. BuyOrderEvent( customer == $c , $id : id ) from entry-point “Home Broker Stream”
  • 207. BuyAckEvent( sourceEvent == $id ) from entry-point “Stock Trader Stream”
  • 208. then
  • 209. // take some action
  • 210. end
  • 211. No notion of “flow of time” : the engine sees all facts without regard to time
  • 213. No requirements on event ordering
  • 214. No automatic event lifecycle management
  • 215. No sliding window support Notion of “flow of time” : concept of “now”
  • 216. Session Clock has an active role synchronizing the reasoning
  • 217. Event Streams must be ordered
  • 218. Automatic event lifecycle management
  • 219. Sliding window support
  • 220. Automatic rule delaying on absence of facts Drools Fusion – Cloud Mode, Stream Mode, Session Clock CLOUD STREAM
  • 221. Drools Fusion – Reference Clock Reference clock defines the flow of time Named Session Clock is assigned to each session created Synchronizes time sensitive operations duration rules
  • 225. Drools Fusion – Session Clock Uses the strategy pattern and multiple implementations: Real-time operation
  • 226. Tests
  • 228. etc
  • 229. Drools Fusion – Session Clock Selecting the session clock: API: KnowledgeSessionConfiguration conf = ...
  • 230. conf.setOption( ClockTypeOption.get( “realtime” ) ); System Property or Configuration File: drools.clockType = pseudo
  • 231. Drools Fusion – Sliding Window Support Allows reasoning over a moving window of “interest” Time
  • 232. Length Sliding window 1 Sliding window 2
  • 233. Drools Fusion – Sliding Window Support Allows reasoning over a moving window of “interest” Time
  • 234. Length Sliding window 1 Sliding window 2 Joined window
  • 235. Drools Fusion – Sliding Window Support Allows reasoning over a moving window of “interest” Time
  • 236. Length Demo twitter rules part 5 rule “Average Order Value over 12 hours” when $c : Customer() $a : Number() from accumulate ( BuyOrder( customer == $c , $p : price ) over window:time ( 12h ),
  • 237. average ( $p ) )
  • 238. then
  • 240. end
  • 241. Drools Fusion – Delaying Rules Negative patterns may require rule firings to be delayed. rule “Order timeout” when $bse : BuyShares ( $id : id ) not BuySharesAck( id == $id , this after[0s,30s] $bse ) then // Buy order was not acknowledged. Cancel operation // by timeout. end Forces the rule to wait for 30 seconds before firing, because the acknowledgement may arrive at any time!
  • 242. Drools Fusion – Temporal Dimension Requires the support to the temporal dimension A rule/query might match in a given point in time, and not match in the subsequent point in time That is the single most difficult requirement to support in a way that the engine: stays deterministic
  • 243. stays a high-performance engine Achieved mostly by compile time optimizations that enable: constraint tightening
  • 246. Drools Fusion – Temporal Dimension Support CEP scenarios are stateful by nature.
  • 247. Events usually are only interesting during a short period of time .
  • 248. Hard for applications to know when events are not necessary anymore Temporal constraints and sliding windows describe such “ window of interest ”
  • 249. Drools Fusion – Simple Example Rule rule “Bag was lost” when $b : BagScannedEvent() from entry-point “check-in” not BagScannedEvent( id == $b.id , this after[0s,5m] $b ) from entry-point “pre-load”
  • 250. then
  • 251. // Bag was lost, do something
  • 252. end Easy to “see” that the only temporal relationship between the events defines a 5 minutes interest window.
  • 253. Drools Fusion – Abstract Example Rule rule “Abstract event relationship example” when $a : A() $b : B( this after[-2, 2] $a ) $c : C( this after[-3, 4] $a ) $d : D( this after[ 1, 2] $b, this after[2,3] $c ) not E( this after[ 1,10] $d ) then // Bag was lost, do something end How about now? What is the temporal relationship between A and E?
  • 254. Drools Fusion – Temporal Dependency Matrix A B C D E A [ 0, 0 ] [ -2, 2 ] [ -3, 2 ] [ -1, 4 ] [ 0, 14 ] B [ -2, 2 ] [ 0, 0 ] [ -2, 0 ] [ 1, 2 ] [ 2, 12 ] C [ -2, 3 ] [ 0, 2 ] [ 0, 0 ] [ 2, 3 ] [ 3, 13 ] D [ -4, 1 ] [ -2, -1 ] [ -3, -2 ] [ 0, 0 ] [ 1, 10 ] E [ -14, 0 ] [ -12, -2 ] [ -13, -3 ] [-10,-1 ] [ 0, 0 ] Constraint tightening Demo twitter rules part 6 [-2,2] [-3,4] [2,3] [1,2] [1,10] A D B E C
  • 255. Q&A Drools project site: http://www.drools.org ( http://www.jboss.org/drools/ ) Documentation: http://www.jboss.org/drools/documentation.html Tihomir Surdilovic – tsurdilo @redhat.com