[rules-users] endless loop even with "no-loop"

Gabor Szokoli szocske at gmail.com
Thu Mar 24 06:02:33 EDT 2011


Maybe your actual business needs have a procedural, flow chart like
aspect to them?
You can chain ruleflow groups in Drools Flow...

If your needs are mostly declarative and you'd like to handle a rare
exception with this "fire once" rule, it can be done of course by
tweaking the rule a bit:
One way is to add an attribute to your fact object, or a "marker fact"
for rule 1 to signal itself it need not run ever again:
(Sorry, I don't have an environment to try this right now, can't vouch
for the syntax... Would anyone consider hosting a drools sandbox?)

rule "rule 1"
       when
               m : Message( status == Message.HELLO)
               not IsProcessed(m);
       then
               System.out.println( "rule 1" );
               m.setMessage( "update 1" );
               insert (IsProcessed(m));
               update( m );

end




On Thu, Mar 24, 2011 at 10:27 AM, James Gu <jxgu at cnsh.delphi-tech.com> wrote:
> I tried lock-on-active and it is better than no-loop because it can avoid
> activate other rules in a group. Maybe it is too strong for me.
>
> What I want is :
>
> rule 1 change a attribute and it tells other rules (for example, rule 2)
> that the fact data is changed. rule 2 change another attribute, but do not
> fire rule 1 again because it is already executed. Each rule should be fired
> once at most.
>
> Is there anyway to do this?
>
> --
> View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/endless-loop-even-with-no-loop-tp2719917p2724411.html
> Sent from the Drools - User mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>



More information about the rules-users mailing list