-
1. Re: Unable to fire rules before and after human task using same rule flow group
salaboy21 Aug 3, 2012 4:10 AM (in response to 0sameerk0)Hi Sameer,
What exactly are your rules evaluating?
Did you turn on the console logger? to see what is happening?
Are you sure that your rules are being activated (condition matched) by your facts?
Cheers
-
2. Re: Unable to fire rules before and after human task using same rule flow group
0sameerk0 Aug 3, 2012 4:58 AM (in response to salaboy21)Hi Mauricio,
Thanks for replying.
Below is the rule which i am trying to execute.
rule "Rule456"
ruleflow-group "validate"
dialect"mvel"
no-loop true;
whenthen
System.out.println("Rule456 Executed");
endThere is no condition as such to match
This rule needs to be fired everytime but its not happening, as posted above.
Thanks.
-
3. Re: Unable to fire rules before and after human task using same rule flow group
salaboy21 Aug 3, 2012 5:02 AM (in response to 0sameerk0)So that's your answer then..
That rule will fire only once, because nothing has changed.
That Rule WILL NOT FIRE multiple times.
-
4. Re: Unable to fire rules before and after human task using same rule flow group
0sameerk0 Aug 3, 2012 7:06 AM (in response to salaboy21)Hey thanks for prompt reply.
I am newbie to drools as well
Really Appreciate the thought process you putting on for my problem.
I tried updating the processInstance which i am using but still my rule is not fired second time from second rule task.
rule "Rule123"
ruleflow-group "validate"
no-loop
when
processInstance : WorkflowProcessInstance()
then
System.out.println("Rule123 Executed");
processInstance.setVariable("abc","xyz");
update(processInstance);
endAlso, if i had to write some sort of validation rule and call it from both the rule task how can i do it?
For e.g if i want to check if businessName=="xyz" then log it to db/some file.
I need to check businessName before calling human task and after humantask as well....how can this be achieved?
Can we configure rules in such a way, that those set of rules will be called everytime/whenever we want them to be executed.
Like we make a call using rule task and those set of flow-group gets executed.
Thanks.
-
5. Re: Unable to fire rules before and after human task using same rule flow group
0sameerk0 Aug 7, 2012 10:10 AM (in response to salaboy21)I am using the below rule.
rule "RuleCheck"
ruleflow-group "validate"
no-loop
when
processInstance : WorkflowProcessInstance()
then
System.out.println("RuleCheck Executed="+processInstance.getId());
endThe log for above rule when i use the same rule-flow-group for multiple rule task in same process i.e. the flow mentioned in first post above is:
For 1st rule task
BEFORE RULEFLOW GROUP ACTIVATED group:validate[size=1]
BEFORE ACTIVATION FIRED rule:RuleCheck activationId:RuleCheck [1] declarations: processInstance=WorkflowProcessInstance26 [processId=Flow123,state=1](1) ruleflow-group: validateRuleCheck Executed=25
For 2nd rule task
BEFORE RULEFLOW GROUP ACTIVATED group:validate[size=0] {I think this is the catch, might be wrong}
I feel from above log is that rule-flowgroup needs to be reactivated again, so that we get the size.
Can some one tell me how can we re-activate the rule flow group and then call fireallrules from afterRuleFlowGroupActivated method of AgendaEventListener.
Or atleast provide some pointers on how the AgendaEventListener and its methods work.
Thanks.
-
6. Re: Unable to fire rules before and after human task using same rule flow group
ted.pan Oct 12, 2012 2:12 PM (in response to 0sameerk0)I know this post is 2-month old. My answer may be useful for other people.
as mentioned by Mauricio, the rule will be only fired once if there is nothing change.
You can use a dumy object to re-activiate the rule, for example,
in human task 1's exit actions, add the following script:
kcontext.setVariable("TEST",System.currentTimeMillis());
and then change your rule to add the following script to LHS
eval($processInstance.getVariable("TEST")!=null)