[rules-users] Rule does not fire when JBPM asks to do so in BPMN 2.0 process

argaldo argaldo at gmail.com
Wed Feb 8 11:54:55 EST 2012


I'm afraid I can't publish as it is, but I hope this would give you a hint:

myrules.drl:

rule "New case"
    when
        $case : Case(processed==false) from entry-point "case stream"

    then
        modify ($case){
            setProcessed(true)
        }

        [....  processing code omitted ... ]


insert(kcontext.getKnowledgeRuntime().startProcess("com.mycompany.Process",
parameters));
end

rule "job complete"
ruleflow-group "jobs group"
    when
        $processInstance: WorkflowProcessInstance()
    then
        Job job = (Job)$processInstance.getVariable("var");
        update(job);
end




process.bpmn:

<?xml version="1.0" encoding="UTF-8"?>
<definitions ....>
<process processType="Private" isExecutable="true"
id="com.mycompany.Process" name="process" >
[one start node and lots of nodes here, one that ends in the next ]

<businessRuleTask g:ruleFlowGroup="jobs group" id="job complete"
name="complete job"/>

[ lots of nodes after, ending in an end node]

</process>
</definitions>




As you can see the rule "New case" is not in any group and is responsible (
if it is the case ) of launching the process, and then that process invokes
the bussinessrule group "jobs group". As stated, what we see is that the
rule "job complete" never gets fired.



Alberto R. Galdo
argaldo at gmail.com

On Tue, Feb 7, 2012 at 21:18, salaboy [via Drools] <
ml-node+s46999n3723757h20 at n3.nabble.com> wrote:

> ""businessRuleTask" who tries to fire a rule in drools ant that rule
> are not in the same group" can you share the process definition and
> the rule?
>
> 2012/2/7 Alberto R. Galdo <[hidden email]<http://user/SendEmail.jtp?type=node&node=3723757&i=0>>:
>
>
> > Hi,
> >
> >    The rule that inserts the process which has the node
> "businessRuleTask"
> > who tries to fire a rule in drools ant that rule are not in the same
> group.
> > In fact, the rule that should be fired is the only rule in that group
> and
> > should only be fired by the process itself.
> >
> >    What we are trying to do is to update the state of a fact inside
> drools
> > with information gathered in the BPM process. Maybe I am getting this
> wrong,
> > but, Is there another way to accomplish this?
> >
> > Greets,
> >
> >
> > Alberto R. Galdo
> > [hidden email] <http://user/SendEmail.jtp?type=node&node=3723757&i=1>
> >
> >
> >
> >
> > On Tue, Feb 7, 2012 at 19:23, Mauricio Salatino <[hidden email]<http://user/SendEmail.jtp?type=node&node=3723757&i=2>>
> wrote:
> >>
> >> Hi are you using the same rule flow-group in the businessRuleTask and
> >> in your rule? can you share the rule that you are using?
> >> remember that the evaluation will be done by the engine as soon as the
> >> information comes in. The rule flow group will only execute something
> >> if a rule was activated inside the rule flow group of your
> >> businessRuleTask.
> >> Cheers
> >>
> >> On Tue, Feb 7, 2012 at 2:23 PM, argaldo <[hidden email]<http://user/SendEmail.jtp?type=node&node=3723757&i=3>>
> wrote:
> >> > Hi,
> >> >
> >> >  We're running an application that uses Drools + JBPM 5 + Drools
> >> > integration our set-up can be seen as:
> >> >
> >> >  Some rule fires and creates a JBPM process ( a fact gets inserted
> into
> >> > drools using "kcontext.getKnowledgeRuntime().startProcess()" ), after
> a
> >> > few
> >> > nodes processed, the JBPM engine arrives to a node of type
> >> > "businessRuleTask" which in turn tells drools to evaluate a group of
> >> > rules (
> >> > which at the moment consists on only one rule ).
> >> >
> >> >  Well, the problem is that what we see is that everything runs ok
> before
> >> > the businessRuleTask and at the moment when the rule group would be
> >> > evaluated we could see that in drools the rule gets created,
> activated,
> >> > but
> >> > never fired.
> >> >
> >> >  We did some debug and realized that the reason the rule group never
> got
> >> > fired is because this check in RuleFlowGroupImpl.java ( method
> >> > setActive(boolean) ):
> >> >
> >> >            if ( this.list.isEmpty() ) {
> >> >                if ( this.autoDeactivate ) {
> >> >                    // if the list of activations is empty and
> >> >                    // auto-deactivate is on, deactivate this group
> >> >                    WorkingMemoryAction action = new
> DeactivateCallback(
> >> > this );
> >> >                    this.workingMemory.queueWorkingMemoryAction(
> action
> >> > );
> >> >                }
> >> >            }
> >> >
> >> >
> >> >   The problem is that at the moment when drools calls setActive() and
> >> > performs the check, this.list is in fact empty and autoDeactivate is
> >> > true by
> >> > default ). Then drools enqueues a deactivation task afterwords, which
> >> > deactivates the rule *before* even firing it.
> >> >
> >> >    From now on, things get a little weirder, every subsequent
> invocation
> >> > of
> >> > the method setActive ( in response of bussinessRuleTask from our
> >> > bussiness
> >> > process ) runs ok as that list now is not empty ( has one rule ).
> >> >
> >> >    Seems a race condition to me, but,...,  Is there any way to
> >> > deactivate
> >> > autodeactivation by default? Are we doing something wrong? Bug
> report?
> >> >
> >> > Greets,
> >> >
> >> > --
> >> > View this message in context:
> >> >
> http://drools.46999.n3.nabble.com/Rule-does-not-fire-when-JBPM-asks-to-do-so-in-BPMN-2-0-process-tp3723183p3723183.html
> >> > Sent from the Drools: User forum mailing list archive at Nabble.com.
> >> > _______________________________________________
> >> > rules-users mailing list
> >> > [hidden email] <http://user/SendEmail.jtp?type=node&node=3723757&i=4>
> >> > https://lists.jboss.org/mailman/listinfo/rules-users
> >>
> >>
> >>
> >> --
> >>  - CTO @ http://www.plugtree.com
> >>  - MyJourney @ http://salaboy.wordpress.com
> >>  - Co-Founder @ http://www.jugargentina.org
> >>  - Co-Founder @ http://www.jbug.com.ar
> >>
> >>  - Salatino "Salaboy" Mauricio -
> >>
> >> _______________________________________________
> >> rules-users mailing list
> >> [hidden email] <http://user/SendEmail.jtp?type=node&node=3723757&i=5>
> >> https://lists.jboss.org/mailman/listinfo/rules-users
> >
> >
> >
> > _______________________________________________
> > rules-users mailing list
> > [hidden email] <http://user/SendEmail.jtp?type=node&node=3723757&i=6>
> > https://lists.jboss.org/mailman/listinfo/rules-users
> >
>
>
>
> --
>  - CTO @ http://www.plugtree.com
>  - MyJourney @ http://salaboy.wordpress.com
>  - Co-Founder @ http://www.jugargentina.org
>  - Co-Founder @ http://www.jbug.com.ar
>
>  - Salatino "Salaboy" Mauricio -
>
> _______________________________________________
> rules-users mailing list
> [hidden email] <http://user/SendEmail.jtp?type=node&node=3723757&i=7>
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://drools.46999.n3.nabble.com/Rule-does-not-fire-when-JBPM-asks-to-do-so-in-BPMN-2-0-process-tp3723183p3723757.html
>  To unsubscribe from Rule does not fire when JBPM asks to do so in BPMN
> 2.0 process, click here<http://drools.46999.n3.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=3723183&code=YXJnYWxkb0BnbWFpbC5jb218MzcyMzE4M3wxNjcxNDA3NjQ3>
> .
> NAML<http://drools.46999.n3.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>


--
View this message in context: http://drools.46999.n3.nabble.com/Rule-does-not-fire-when-JBPM-asks-to-do-so-in-BPMN-2-0-process-tp3723183p3726616.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20120208/0eb54db0/attachment.html 


More information about the rules-users mailing list