JBPM and Drools Introduction
Copyright Notice
Copyright © 2004-2023 by NobleProg Limited All rights reserved.
This publication is protected by copyright, and permission must be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise.
jBPM Overview⌘
jBPM General Info ⌘
- jBPM is a BPMS (Business Process Management Suite) written in Java
- It allows you to design, model, execute, and monitor business processes throughout their life cycle.
- Contains Drools - Business Rules Management System (BRMS)
- jBPM, released by JBOSS (Red Hat boght JBOSS)
- Open Source and Commercial
BPMN ⌘
- Business Process Model and Notation (BPMN)
- OMG standard
- similar to flowchart diagram, but
- formal (specification - http://www.omg.org/spec/BPMN/2.0/)
- event based
- with message flows
Business Process⌘
BPMN 2.0 Spec:
A Process describes a sequence or flow of Activities in an organization with the objective of carrying out work.
Howard Smith, Peter Fingar, Business Process Management – The Third Wave, Meghan Kiffer, 2006:
Business Process is the complete and dynamically coordinated set of collaborative and transactional activities that deliver value to customers.
Process Logic⌘
by Bruce Silver
- Process Logic (Process Model) is a complete map of all the paths from the triggering event to any defined end state.
- Process Model is more than documentation of one instance of the process.
- Process logic is usually hidden.
BPMN 2.0 Purpose ⌘
- Provide a notation that is readily understandable by business and technical people
- Create a standardized bridge for the gap between the business process design and process implementation
- To standardize a business process model and notation
- To provide a means of communicating process information to other businesses, users, managers and process implementers
- To exchange BPMN definitions (both domain model and diagram layout) between different tools
Audience of BPMN ⌘
- Business users
- Business analysts
- Strategy analyst
- Quality managers
- Technical developers
- Process designers
- Developers
- Integrators
- Software, System and Enterprise Architects
BPMN Basics⌘
Flow Objects |
Swimlanes |
Connecting Objects |
Artifacts (used to provide additional information about the Process) |
Levels of BPMN Process Modelling⌘
by Bruce Silver - Three Levels of Process Modeling with BPMN, BPMS Watch, April 2008
- Descriptive modeling
- Abstract, high-level, simple to communicate across the organization
- Requires understanding of fundamental concepts such as pools and lanes, tasks and subprocesses and sequence flow, not the complexities of BPMN's various flow control and event patterns
- Analytical modeling
- More details, showing all the steps, including the exception paths required to analyze process performance using simulation or to create details requirements for an IT implementation. Requires understanding of BPMN's various decisions and merge patterns, event and exception handling patterns. Hierarchical representation of the end to end business process
- Executable modeling
- BPMN is a part of the executable process implementation. Imposes many validation constraints.
- Modeling at this level is somewhat vendor tool-dependent.
Sub-models within an end-to-end BPMN model ⌘
- Processes (Orchestration)
- Collaborations
- Choreographies
- Conversations
jBPM components ⌘
source: https://docs.jboss.org/jbpm
BPM tools ⌘
jBPM Workbench Overview ⌘
Starting jBPM console ⌘
cd /opt/jbpm-installer ant start.demo
or
ant start.demo.noeclipse
Go to Firefox and type: http://localhost:8080/jbpm-console
Evaluation Demo ⌘
- An employee performance needs to be evaluated
- First, the employee gives feedback about their own performance
- Later, HR (mary) and PM (john) departments give their opinion about employee department
- It does not matter whether HR or PM evaluation is done first
Lab Executing Process in Kie ⌘
- localhost:8080/jbpm-console
- login krisv/krisv
- Build Project
- Got to Authoring/Project Autorining
- In Project Explorer select demo / jbpm-playground / Evaluation project
- Click BUSINESS PROCESSES / 'evaluation' process to view the diagram
- Click Open Project Editor / Build & Deploy
- Start an Process Instance
- Process Management / Process Definitions
- Actions / Start
- Employee: krisv (must be this user)
- Reason: evaluation
Lab Executing Process in Kie cont.⌘
- Perform Self-Evaluation
- Task List / Actions / Start
- Performance: "I am excellent"
- HR Evaluation
- Log in as mary
- Tasks / Actions / Start
- Click on Magnifying Glass icon / Work tab / Complete
- PM Evaluation
- Log in as john
- Task / Actions / Start
- Click on Magnifying Glass icon / Work tab / Complete
- View Log
- Process Management / Process Instances / Completed
- Actions / Details
Drools Overview ⌘
by Ronald Ross, Business Rule Concepts: Getting to the Point of Knowledge, 4th edition - BRS, 2013
Business Rules⌘
- Rules are familiar to us all in real life.
- We play games by rules, we live under a legal system based on rules, we set rules for our children, and so on.
- Thinking about the control aspect of any organized activity in terms of rules is actually very natural (try explaining any game without explaining the rules the game is based).
What is a Business Rule?⌘
The SBVR follows a common-sense definition of ‘business rule’:
Business Rule: rule that is under business jurisdiction
- ‘Under business jurisdiction’ means that the business can create, revise, and discontinue their business rules as they see fit.
- If a rule is not under business jurisdiction in that sense, then it is not a business rule.
- For example, the ‘law’ of gravity is obviously not a business rule. Neither are the ‘rules’ of mathematics.
Business Rule “Mantra”⌘
“Rules are based on facts, and facts are based on terms.”
Artificial Intelligence ⌘
- Expert Systems are also known as Knowledge-based Systems and Knowledge-based Expert Systems
- Drools is a Rule Engine that uses the rule-based approach to implement an Expert System and is more correctly classified as a Production Rule System.
Rule Engine ⌘
Drools documentation, Figure 1.1. High-level View of a Rule Engine
- The Rules are stored in the Production Memory
- Facts that the Inference Engine matches against are kept in the Working Memory.
- Facts are asserted into the Working Memory where they may then be modified or retracted.
- A system with a large number of rules and facts may result in many rules being true for the same fact assertion; these rules are said to be in conflict.
- The Agenda manages the execution order of these conflicting rules using a Conflict Resolution strategy.
Advantages of a Rule Engine ⌘
- Declarative Programming ("What", not "How")
- Explanation Facility - we can see "how" engine solved the problem
- Logic and Data Separation (breaking OO coupling of data and logic)
- Speed and Scalability (Rete, Leaps, PHREAK)
- Centralization of Knowledge (Documentation)
- Tool Integration
- Understandable Rules (DSL)
When should you use RE? ⌘
- The problem may not be complex but there is no non-fragile way of building a solution for it
- The problem is beyond any obvious algorithmic solution
- The logic changes often
- Domain experts (or business analysts) are readily available, but are nontechnical
- There are too many rules to manage them in the code
- We need rules to be explicit and documented
When shouldn't you use RE? ⌘
- Maintaining the infrastructure is more expensive than the gains
- With system which hardly ever change
- There is no person understanding RE
Alternatives to Rule Engine ⌘
- Scripting
- Decision Tables (Lookup tables, DMN)
- Other data-driven solutions
Rules Syntax ⌘
Rule "Next delegate discount" When $NumberOfDelegates > 1 Then $Price = $Price - $Price*($numberOfDelegates-1)*10% End
Domain Specific Language Rules⌘
- DSL is a way non-technical people can write executable rules in Drools environment
- DSL is ultimately transformed to rules (mvel or java)
- .dsl file contain the transformations (mapping)
The Business Rules Manifesto ⌘
http://www.businessrulesgroup.org/brmanifesto.htm
Rules are not process and not procedure. They should not be contained in either of these.
Rules build on facts, and facts build on concepts as expressed by terms.
If something cannot be expressed, then it is not a rule.
Business rules should be expressed in such a way that they can be validated for correctness by business people.
Exceptions to rules are expressed by other rules.