<br> Throwing exceptions in the consequence is not safe and not advisable.<br> To stop the rules engine you can use the following statement in your consequence:<br><br>drools.halt();<br><br> Use a fact, a call back, or an attribute to identify the problem you detected.
<br><br> []s<br> Edson<br><br><div><span class="gmail_quote">2007/11/15, Ronald R. DiFrango <<a href="mailto:ron.difrango@gmail.com">ron.difrango@gmail.com</a>>:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
All,<br><br>I have a situation where I want the rules execution to stop processing immediately when it encounters a situation like the following:<br><br>rule "Invalid RTV Line"<br> salience 100<br> <br> when
<br> rtvDetailLine : DetailLine(detailRtvNumber:rtvNumber != null, lineNumber != null ) <br> rtvHeader : RtvHeader( rtvNumber != detailRtvNumber )<br> then<br> logger.debug("Invalid RTV Line");
<br> throw new RuntimeException("Invalid RTV Line");<br>end <br><br>Basically this is a parent child relationship and under some circumstances the process that feeds data into the rules it corrupts this relationship. I want to stop the rules process immediately and do nothing further. As you see above, my first attempt is just throw a runtime exception that is caught/ logged and report by the calling program. Does this seem like a reasonable approach or is there a better approach to do this?
<br><br>Ron<br>
<br>_______________________________________________<br>rules-users mailing list<br><a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br><a onclick="return top.js.OpenExtLink(window,event,this)" href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">
https://lists.jboss.org/mailman/listinfo/rules-users</a><br><br></blockquote></div><br><br clear="all"><br>-- <br> Edson Tirelli<br> Software Engineer - JBoss Rules Core Developer<br> Office: +55 11 3529-6000<br> Mobile: +55 11 9287-5646
<br> JBoss, a division of Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a>