<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.3314" name=GENERATOR><!-- converted from rtf -->
<STYLE>.EmailQuote {
        PADDING-LEFT: 4pt; MARGIN-LEFT: 1pt; BORDER-LEFT: #800000 2px solid
}
</STYLE>
</HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=450004110-15012009><FONT face=Arial 
color=#0000ff size=2>You could simply add a "processed" flag and change your 
rules...</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=450004110-15012009><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><FONT face="Courier New" color=#0000ff size=2>rule "Amount 
Validation-Rule1"<BR><SPAN class=450004110-15012009>&nbsp;&nbsp;&nbsp; 
</SPAN>when</FONT></DIV>
<DIV><FONT><FONT color=#0000ff><FONT size=2><FONT face="Courier New"><SPAN 
class=450004110-15012009>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>$c : 
Claims(amount &gt;= ( maxClaimAmount)<SPAN class=450004110-15012009>, processed 
= false</SPAN>&nbsp;)<BR><SPAN class=450004110-15012009>&nbsp;&nbsp;&nbsp; 
</SPAN>then</FONT></FONT></FONT></FONT></DIV>
<DIV><FONT><FONT><FONT color=#0000ff><FONT size=2><FONT face="Courier New"><SPAN 
class=450004110-15012009>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
</SPAN>$c.setMessage ( "The total amount claimed exceeds the maximum permitted 
by the&nbsp;Policy" );</FONT></FONT></FONT></FONT></FONT></DIV>
<DIV><SPAN class=450004110-15012009><FONT face="Courier New" color=#0000ff 
size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
$c.setProcessed(true);</FONT></SPAN></DIV>
<DIV><SPAN class=450004110-15012009><FONT 
face="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT 
color=#0000ff size=2>update($c);</FONT></FONT></SPAN></DIV>
<DIV><SPAN class=450004110-15012009><FONT face="Courier New" color=#0000ff 
size=2>end</FONT></SPAN></DIV>
<DIV><FONT><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN 
class=450004110-15012009>&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><BR><SPAN 
class=450004110-15012009>Otherwise the updates are causing the</SPAN><SPAN 
class=450004110-15012009> fact to be re-accessed by the RETE 
network.</SPAN></FONT></FONT></FONT></FONT></DIV>
<DIV><FONT><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN 
class=450004110-15012009></SPAN></FONT></FONT></FONT></FONT>&nbsp;</DIV>
<DIV><FONT><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN 
class=450004110-15012009>Alternatively you could use a ClaimOutcome 
object...</SPAN></FONT></FONT></FONT></FONT></DIV>
<DIV><FONT><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN 
class=450004110-15012009></SPAN></FONT></FONT></FONT></FONT>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=450004110-15012009><FONT face=Arial size=2>
<DIV><FONT face="Courier New" color=#0000ff size=2>rule "Amount 
Validation-Rule1"<BR><SPAN class=450004110-15012009>&nbsp;&nbsp;&nbsp; 
</SPAN>when</FONT></DIV>
<DIV><FONT size=+0><FONT size=2><FONT color=#0000ff><FONT 
face="Courier New"><SPAN 
class=450004110-15012009>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>$c : 
Claims(amount &gt;= ( maxClaimAmount))</FONT></FONT></FONT></FONT></DIV>
<DIV><FONT><FONT><FONT color=#0000ff><FONT face="Courier New"><SPAN 
class=450004110-15012009>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;not 
ClaimOutcome(claim = $c)</SPAN><BR><SPAN 
class=450004110-15012009>&nbsp;&nbsp;&nbsp; 
</SPAN>then</FONT></FONT></FONT></FONT></DIV>
<DIV><FONT face="Courier New"><SPAN class=450004110-15012009><FONT 
color=#0000ff>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ClaimOutcome co = new 
ClaimOutcome($c, "</FONT></SPAN><FONT size=+0><FONT size=+0><FONT size=2><FONT 
color=#0000ff>The total amount claimed exceeds the maximum permitted by 
the&nbsp;Policy" );</FONT></FONT></FONT></FONT></FONT></DIV>
<DIV><SPAN class=450004110-15012009><FONT color=#0000ff><FONT 
face="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT 
size=2>insert(co);</FONT></FONT></FONT></SPAN></DIV>
<DIV><SPAN class=450004110-15012009><FONT face="Courier New" color=#0000ff 
size=2>end</FONT></SPAN></DIV></FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV><SPAN class=450004110-15012009></SPAN><FONT face="Courier New"><SPAN 
class=450004110-15012009></SPAN></FONT><FONT face=Arial><FONT 
color=#0000ff><FONT size=2>W<SPAN class=450004110-15012009>ith kind 
regards,</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN 
class=450004110-15012009></SPAN></FONT></FONT></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN 
class=450004110-15012009>Mike</SPAN></FONT></FONT></FONT></DIV>
<DIV><BR></DIV>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
  <DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
  <HR tabIndex=-1>
  <FONT face=Tahoma size=2><B>From:</B> rules-dev-bounces@lists.jboss.org 
  [mailto:rules-dev-bounces@lists.jboss.org] <B>On Behalf Of </B>Sarath Kumar 
  Daruru<BR><B>Sent:</B> 15 January 2009 10:06<BR><B>To:</B> 
  'rules-dev@lists.jboss.org'<BR><B>Subject:</B> [rules-dev] Need to Exit from 
  DRL without using drools.halt()<BR></FONT><BR></DIV>
  <DIV></DIV><FONT face="Bell MT, serif" size=3>
  <DIV>&nbsp;</DIV>
  <DIV>Hi All,</DIV>
  <DIV>I have small doubt in the DRL file execution. I have developing the small 
  Claims application. I have 4 rules in my application. Below are the rules I 
  have declared in the drl file based on the rules.</DIV>
  <DIV>&nbsp;</DIV>
  <DIV><U><B>Claims.drl </B></U></DIV>
  <DIV style="PADDING-LEFT: 36pt">rule "Amount Validation-Rule1"</DIV>
  <DIV style="PADDING-LEFT: 36pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  when </DIV>
  <DIV style="PADDING-LEFT: 36pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp; $c : Claims(amount &gt;= ( maxClaimAmount) )</DIV>
  <DIV style="PADDING-LEFT: 36pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  then</DIV>
  <DIV style="PADDING-LEFT: 36pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp; $c.setMessage ( "The total amount claimed exceeds the 
  maximum permitted by the</DIV>
  <DIV 
  style="PADDING-LEFT: 36pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  Policy" ); </DIV>
  <DIV style="PADDING-LEFT: 36pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; update($c);</DIV>
  <DIV style="PADDING-LEFT: 36pt">end</DIV>
  <DIV style="PADDING-LEFT: 36pt">&nbsp;</DIV>
  <DIV style="PADDING-LEFT: 36pt">rule "Expired Policy-Rule2" </DIV>
  <DIV style="PADDING-LEFT: 36pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  when</DIV>
  <DIV style="PADDING-LEFT: 36pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp; $c : Claims( currentDate &gt; ( policyExpireDate ))</DIV>
  <DIV style="PADDING-LEFT: 36pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  then</DIV>
  <DIV style="PADDING-LEFT: 36pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp; $c.setMessage( "Your Policy has been expired" ); </DIV>
  <DIV style="PADDING-LEFT: 36pt; TEXT-INDENT: 36pt">&nbsp;&nbsp;&nbsp;&nbsp; 
  update($c);</DIV>
  <DIV style="PADDING-LEFT: 36pt">end</DIV>
  <DIV style="PADDING-LEFT: 36pt">&nbsp;</DIV>
  <DIV style="PADDING-LEFT: 36pt">rule "Feature Date-Rule3" </DIV>
  <DIV style="PADDING-LEFT: 36pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  when</DIV>
  <DIV style="PADDING-LEFT: 36pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $c : Claims( claimDate &gt;= ( currentDate ) 
  )</DIV>
  <DIV style="PADDING-LEFT: 36pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  then</DIV>
  <DIV style="PADDING-LEFT: 36pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  </DIV>
  <DIV style="PADDING-LEFT: 36pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $c.setMessage( "Rejecting the claim because the 
  date on the claim is in the future" 
  );&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  </DIV>
  <DIV 
  style="PADDING-LEFT: 36pt; TEXT-INDENT: 36pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  update($c);</DIV>
  <DIV style="PADDING-LEFT: 36pt">end</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>and my java class is </DIV>
  <DIV><U><B>Claims.java</B></U></DIV>
  <DIV>&nbsp;</DIV>
  <DIV style="PADDING-LEFT: 36pt"><FONT face="Courier New, monospace" 
  color=#3f7f5f size=2>// Setting the values to Claims object</FONT></DIV>
  <DIV style="PADDING-LEFT: 36pt"><FONT face="Courier New, monospace" 
  size=2>Claims rule = <FONT color=#7f0055><B>new</B></FONT> Claims 
  ();</FONT></DIV>
  <DIV style="PADDING-LEFT: 36pt"><FONT face="Courier New, monospace" 
  size=2>rule.setAmount(amount);</FONT></DIV>
  <DIV style="PADDING-LEFT: 36pt"><FONT face="Courier New, monospace" 
  size=2>rule.setClaimsHospitalStayeddays(claimsHospitalStayeddays);</FONT></DIV>
  <DIV style="PADDING-LEFT: 36pt"><FONT face="Courier New, monospace" 
  size=2>rule.setClaimDate(claimDate);</FONT></DIV>
  <DIV style="PADDING-LEFT: 36pt"><FONT face="Courier New, monospace" 
  size=2>rule.setCurrentDate(currentDate);</FONT></DIV>
  <DIV style="PADDING-LEFT: 36pt"><FONT face="Courier New, monospace" 
  size=2>rule.setDaysPermitted(<FONT 
  color=#0000c0>daysPermitted</FONT>);</FONT></DIV>
  <DIV style="PADDING-LEFT: 36pt"><FONT face="Courier New, monospace" 
  size=2>rule.setPolicyExpireDate(<FONT 
  color=#0000c0>policyExpireDate</FONT>);</FONT></DIV>
  <DIV style="PADDING-LEFT: 36pt"><FONT face="Courier New, monospace" 
  size=2>rule.setCurrentDate(currentDate);</FONT></DIV>
  <DIV style="PADDING-LEFT: 36pt"><FONT face="Courier New, monospace" 
  size=2>rule.setMaxClaimAmount(<FONT 
  color=#0000c0>maxClaimAmount</FONT>);</FONT></DIV>
  <DIV style="PADDING-LEFT: 36pt"><FONT 
  face="Times New Roman, serif"></FONT>&nbsp;</DIV>
  <DIV style="PADDING-LEFT: 36pt"><FONT face="Courier New, monospace" 
  size=2>StatefulSession workingMemory = 
  ruleBase.newStatefulSession();</FONT></DIV>
  <DIV style="PADDING-LEFT: 36pt"><FONT face="Courier New, monospace" 
  size=2>workingMemory.insert(rule);</FONT></DIV>
  <DIV style="PADDING-LEFT: 36pt"><FONT face="Courier New, monospace" 
  size=2>workingMemory.fireAllRules();</FONT></DIV><A name=_MailAutoSig></A>
  <DIV>&nbsp;</DIV>
  <DIV>If my first rule is fails then it is displaining in the messaege I 
  managed to get that value in my java class. If the condition is not satisfied 
  then is fell into the infinte loop. Again and again it is calling, not coming 
  from that loop. If I keep the drools.halt(); at the end of the rule then it is 
  executing. </DIV>
  <DIV>My question &#8211; Is there any alternate method is there to come out from 
  infinte loop without using drools.halt(); method? Why it is fell into the 
  infinite loop?</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>Thanks, </DIV>
  <DIV>Sarath Kumar Daruru </DIV>
  <DIV>&nbsp;</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>&nbsp;</DIV></BLOCKQUOTE></FONT></BODY></HTML>