<br>&nbsp;&nbsp;&nbsp; Throwing exceptions in the consequence is not safe and not advisable.<br>&nbsp;&nbsp;&nbsp; To stop the rules engine you can use the following statement in your consequence:<br><br>drools.halt();<br><br>&nbsp;&nbsp;&nbsp; Use a fact, a call back, or an attribute to identify the problem you detected.
<br><br>&nbsp;&nbsp;&nbsp; []s<br>&nbsp;&nbsp;&nbsp; Edson<br><br><div><span class="gmail_quote">2007/11/15, Ronald R. DiFrango &lt;<a href="mailto:ron.difrango@gmail.com">ron.difrango@gmail.com</a>&gt;:</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 &quot;Invalid RTV Line&quot;<br>&nbsp;&nbsp;&nbsp; salience 100<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; when
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; rtvDetailLine : DetailLine(detailRtvNumber:rtvNumber != null, lineNumber != null ) <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; rtvHeader : RtvHeader( rtvNumber != detailRtvNumber )<br>&nbsp;&nbsp;&nbsp; then<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; logger.debug(&quot;Invalid RTV Line&quot;);
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; throw new RuntimeException(&quot;Invalid RTV Line&quot;);<br>end&nbsp;&nbsp;&nbsp; <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.&nbsp; I want to stop the rules process immediately and do nothing further.&nbsp; As you see above, my first attempt is just throw a runtime exception that is caught/ logged and report by the calling program.&nbsp; 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>&nbsp;&nbsp;Edson Tirelli<br>&nbsp;&nbsp;Software Engineer - JBoss Rules Core Developer<br>&nbsp;&nbsp;Office: +55 11 3529-6000<br>&nbsp;&nbsp;Mobile: +55 11 9287-5646
<br>&nbsp;&nbsp;JBoss, a division of Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a>