I'm afraid I can't publish as it is, but I hope this would give you a hint:<br><br>myrules.drl:<br><br>rule "New case" <br> when <br> $case : Case(processed==false) from entry-point "case stream" <br>
then<br> modify ($case){<br> setProcessed(true)<br> }<br> <br> [.... processing code omitted ... ]<br><br> insert(kcontext.<div id=":44">getKnowledgeRuntime().startProcess("com.mycompany.Process", parameters));<br>
end<br><br>rule "job complete"<br>ruleflow-group "jobs group"<br> when<br> $processInstance: WorkflowProcessInstance()<br> then<br> Job job = (Job)$processInstance.getVariable("var");<br>
update(job);<br>end<br><br><br><br><br>process.bpmn:<br><br><?xml version="1.0" encoding="UTF-8"?><br><definitions ....><br><process processType="Private" isExecutable="true" id="com.mycompany.Process" name="process" ><br>
[one start node and lots of nodes here, one that ends in the next ]<br><br><businessRuleTask g:ruleFlowGroup="jobs group" id="job complete" name="complete job"/><br><br>[ lots of nodes after, ending in an end node]<br>
<br></process><br></definitions><br><br><br><br><br>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.<br>
<br><br><br clear="all">Alberto R. Galdo<br><a href="mailto:argaldo@gmail.com" target="_blank">argaldo@gmail.com</a><br><br></div><br clear="all">Alberto R. Galdo<br><a href="mailto:argaldo@gmail.com">argaldo@gmail.com</a><br>
<br><br><br><div class="gmail_quote">On Tue, Feb 7, 2012 at 21:16, Mauricio Salatino <span dir="ltr"><<a href="mailto:salaboy@gmail.com">salaboy@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div class="im">""businessRuleTask" who tries to fire a rule in drools ant that rule<br>
</div>are not in the same group" can you share the process definition and<br>
the rule?<br>
<br>
2012/2/7 Alberto R. Galdo <<a href="mailto:argaldo@gmail.com">argaldo@gmail.com</a>>:<br>
<div class="HOEnZb"><div class="h5">> Hi,<br>
><br>
> The rule that inserts the process which has the node "businessRuleTask"<br>
> who tries to fire a rule in drools ant that rule are not in the same group.<br>
> In fact, the rule that should be fired is the only rule in that group and<br>
> should only be fired by the process itself.<br>
><br>
> What we are trying to do is to update the state of a fact inside drools<br>
> with information gathered in the BPM process. Maybe I am getting this wrong,<br>
> but, Is there another way to accomplish this?<br>
><br>
> Greets,<br>
><br>
><br>
> Alberto R. Galdo<br>
> <a href="mailto:argaldo@gmail.com">argaldo@gmail.com</a><br>
><br>
><br>
><br>
><br>
> On Tue, Feb 7, 2012 at 19:23, Mauricio Salatino <<a href="mailto:salaboy@gmail.com">salaboy@gmail.com</a>> wrote:<br>
>><br>
>> Hi are you using the same rule flow-group in the businessRuleTask and<br>
>> in your rule? can you share the rule that you are using?<br>
>> remember that the evaluation will be done by the engine as soon as the<br>
>> information comes in. The rule flow group will only execute something<br>
>> if a rule was activated inside the rule flow group of your<br>
>> businessRuleTask.<br>
>> Cheers<br>
>><br>
>> On Tue, Feb 7, 2012 at 2:23 PM, argaldo <<a href="mailto:argaldo@gmail.com">argaldo@gmail.com</a>> wrote:<br>
>> > Hi,<br>
>> ><br>
>> > We're running an application that uses Drools + JBPM 5 + Drools<br>
>> > integration our set-up can be seen as:<br>
>> ><br>
>> > Some rule fires and creates a JBPM process ( a fact gets inserted into<br>
>> > drools using "kcontext.getKnowledgeRuntime().startProcess()" ), after a<br>
>> > few<br>
>> > nodes processed, the JBPM engine arrives to a node of type<br>
>> > "businessRuleTask" which in turn tells drools to evaluate a group of<br>
>> > rules (<br>
>> > which at the moment consists on only one rule ).<br>
>> ><br>
>> > Well, the problem is that what we see is that everything runs ok before<br>
>> > the businessRuleTask and at the moment when the rule group would be<br>
>> > evaluated we could see that in drools the rule gets created, activated,<br>
>> > but<br>
>> > never fired.<br>
>> ><br>
>> > We did some debug and realized that the reason the rule group never got<br>
>> > fired is because this check in RuleFlowGroupImpl.java ( method<br>
>> > setActive(boolean) ):<br>
>> ><br>
>> > if ( this.list.isEmpty() ) {<br>
>> > if ( this.autoDeactivate ) {<br>
>> > // if the list of activations is empty and<br>
>> > // auto-deactivate is on, deactivate this group<br>
>> > WorkingMemoryAction action = new DeactivateCallback(<br>
>> > this );<br>
>> > this.workingMemory.queueWorkingMemoryAction( action<br>
>> > );<br>
>> > }<br>
>> > }<br>
>> ><br>
>> ><br>
>> > The problem is that at the moment when drools calls setActive() and<br>
>> > performs the check, this.list is in fact empty and autoDeactivate is<br>
>> > true by<br>
>> > default ). Then drools enqueues a deactivation task afterwords, which<br>
>> > deactivates the rule *before* even firing it.<br>
>> ><br>
>> > From now on, things get a little weirder, every subsequent invocation<br>
>> > of<br>
>> > the method setActive ( in response of bussinessRuleTask from our<br>
>> > bussiness<br>
>> > process ) runs ok as that list now is not empty ( has one rule ).<br>
>> ><br>
>> > Seems a race condition to me, but,..., Is there any way to<br>
>> > deactivate<br>
>> > autodeactivation by default? Are we doing something wrong? Bug report?<br>
>> ><br>
>> > Greets,<br>
>> ><br>
>> > --<br>
>> > View this message in context:<br>
>> > <a href="http://drools.46999.n3.nabble.com/Rule-does-not-fire-when-JBPM-asks-to-do-so-in-BPMN-2-0-process-tp3723183p3723183.html" target="_blank">http://drools.46999.n3.nabble.com/Rule-does-not-fire-when-JBPM-asks-to-do-so-in-BPMN-2-0-process-tp3723183p3723183.html</a><br>
>> > Sent from the Drools: User forum mailing list archive at Nabble.com.<br>
>> > _______________________________________________<br>
>> > rules-users mailing list<br>
>> > <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
>> > <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
>><br>
>><br>
>><br>
>> --<br>
>> - CTO @ <a href="http://www.plugtree.com" target="_blank">http://www.plugtree.com</a><br>
>> - MyJourney @ <a href="http://salaboy.wordpress.com" target="_blank">http://salaboy.wordpress.com</a><br>
>> - Co-Founder @ <a href="http://www.jugargentina.org" target="_blank">http://www.jugargentina.org</a><br>
>> - Co-Founder @ <a href="http://www.jbug.com.ar" target="_blank">http://www.jbug.com.ar</a><br>
>><br>
>> - Salatino "Salaboy" Mauricio -<br>
>><br>
>> _______________________________________________<br>
>> rules-users mailing list<br>
>> <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
>> <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
><br>
><br>
><br>
> _______________________________________________<br>
> rules-users mailing list<br>
> <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
> <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
><br>
<br>
<br>
<br>
--<br>
- CTO @ <a href="http://www.plugtree.com" target="_blank">http://www.plugtree.com</a><br>
- MyJourney @ <a href="http://salaboy.wordpress.com" target="_blank">http://salaboy.wordpress.com</a><br>
- Co-Founder @ <a href="http://www.jugargentina.org" target="_blank">http://www.jugargentina.org</a><br>
- Co-Founder @ <a href="http://www.jbug.com.ar" target="_blank">http://www.jbug.com.ar</a><br>
<br>
- Salatino "Salaboy" Mauricio -<br>
<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</div></div></blockquote></div><br>