Hey Shawn,
The fireAllRules() call can take an integer which specifies the
maximum amount of rules which can fire during each call. If the limit is
reached the engine will return, not firing the other rules on the
Agenda(stopping the loop in your case). We've had a similar problem. We
solved it doing two things. First, our application passes in a
threshold. Then, if we hit the limit our application initializes the
WorkingMemoryConsole logger before fireAllRules is called again. That
way we can easily identify which rule(s) are causing the loop.
Hope that helps,
Dan
-----Original Message-----
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Garner, Shawn
Sent: Friday, January 29, 2010 1:01 PM
To: rules-users(a)lists.jboss.org
Subject: [rules-users] prevent infinite loops
Is there a good way to globally prevent infinite loops.
I had rule A and rule B and they both have FactA on the condition.
They also both modify FactA.
I tried no-loop and it prevents a loop of repeating RuleA over and over.
However it then goes from Rule A back to Rule B back to Rule A.
I fixed it by lock-on-active instead of no-loop.
However I was wondering if there was either a timeout feature or a
maximum number of times you could set a rule to be executed to error out
on infinite loops.
Any guidance would be appreciated.
Thanks,
SDG
-----Message Disclaimer-----
This e-mail message is intended only for the use of the individual or
entity to which it is addressed, and may contain information that is
privileged, confidential and exempt from disclosure under applicable
law.
If you are not the intended recipient, any dissemination, distribution
or
copying of this communication is strictly prohibited. If you have
received this communication in error, please notify us immediately by
reply email to Connect(a)principal.com and delete or destroy all copies of
the original message and attachments thereto. Email sent to or from the
Principal Financial Group or any of its member companies may be retained
as required by law or regulation.
Nothing in this message is intended to constitute an Electronic
signature
for purposes of the Uniform Electronic Transactions Act (UETA) or the
Electronic Signatures in Global and National Commerce Act ("E-Sign")
unless a specific statement to the contrary is included in this message.
While this communication may be used to promote or market a transaction
or an idea that is discussed in the publication, it is intended to
provide
general information about the subject matter covered and is provided
with
the understanding that The Principal is not rendering legal, accounting,
or tax advice. It is not a marketed opinion and may not be used to avoid
penalties under the Internal Revenue Code. You should consult with
appropriate counsel or other advisors on all matters pertaining to
legal,
tax, or accounting obligations and requirements.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users