fr13d [
https://community.jboss.org/people/fr13d] created the discussion
"Philosophy of rules in jBPM"
To view the discussion, visit:
https://community.jboss.org/message/766624#766624
--------------------------------------------------------------
Hi all,
I'm new to Drools and we are investigating its potential for a new project (using
version 5.4.0). I understand that rules (Expert) and processes (jBPM) have a different
approach. As I understand it, rules (potentially a large set) are very effectively applied
to facts (potentially also a large set of objects). A process on the other hand operates
on process variables and represents (in effect) changes in state - typically one object at
a time for the simple reason that you don't want to mix up unrelated facts/variables
in the same instance of a process.
As also noted in the Drools documentation, a business might want a mix-and-match approach,
using both rules and processes. A typical example (simplified real-world) just to
illustrate the previous sentence:
1. All mobile phone customers with contracts 11 months or older, and who have not received
an upgraded in the past 11 months, are eligible to upgrade their phones (RULE)
2. Eligible customers need to go through the following PROCESS to receive the upgrade:1.
Check customer's contact details, update if necessary (Task involving web forms)
2. Do credit check on customer (RULES to determine credit rating)
3. If sufficiently high credit rating (XOR Gateway):* Have customer select preferred phone
handset, and supply (Human task)
* Update inventory (Task)
Ideally, business users/analysts (no Java knowledge) should be able to define most or all
of each process and rule, using Guvnor (its graphical editor).
So far, we've worked through various Hello World examples, and have created a simple
process (all in Guvnor) that also activates a Rule Task (by using the ruleflow-group
attribute in the task as well as in the rule). So far so good. Now we start to add some
logic: the rule task modifies the object that triggered it by setting some
"outcome" field. The idea is to use this "outcome" value in a gateway
(similar to the credit check in the example). However, moving values from facts (rules) to
variables (process) involves some complicated Java code (from the business user's POV)
that one ideally doesn't want them to do or see. There doesn't seem to be an easy
way to reference the same object(s) used in a rule, in process nodes (as they work
differently).
1. Are we on the right track in trying to combine rules and processes in this way?
2. If so, what is the right way (or at least the simplest way) to achieve this?
3. What is the possibility of a domain object (fact) being used in a long-running process,
also being modified by another completely independent rule/process, and one ending up with
2 clashing versions of the object?
Thanks in advance for any views/explanations about the fundamental workings of rules and
jBPM in Drools, and also for any practical examples to make the above work.
--------------------------------------------------------------
Reply to this message by going to Community
[
https://community.jboss.org/message/766624#766624]
Start a new discussion in jBPM at Community
[
https://community.jboss.org/choose-container!input.jspa?contentType=1&...]