Hi All,
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.
Claims.drl
rule "Amount Validation-Rule1"
when
$c : Claims(amount >= ( maxClaimAmount) )
then
$c.setMessage ( "The total amount claimed exceeds the maximum permitted
by the
Policy" );
update($c);
end
rule "Expired Policy-Rule2"
when
$c : Claims( currentDate > ( policyExpireDate ))
then
$c.setMessage( "Your Policy has been expired" );
update($c);
end
rule "Feature Date-Rule3"
when
$c : Claims( claimDate >= ( currentDate ) )
then
$c.setMessage( "Rejecting the claim because the date on the claim is in
the future" );
update($c);
end
and my java class is
Claims.java
// Setting the values to Claims object
Claims rule = new Claims ();
rule.setAmount(amount);
rule.setClaimsHospitalStayeddays(claimsHospitalStayeddays);
rule.setClaimDate(claimDate);
rule.setCurrentDate(currentDate);
rule.setDaysPermitted(daysPermitted);
rule.setPolicyExpireDate(policyExpireDate);
rule.setCurrentDate(currentDate);
rule.setMaxClaimAmount(maxClaimAmount);
StatefulSession workingMemory = ruleBase.newStatefulSession();
workingMemory.insert(rule);
workingMemory.fireAllRules();
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.
My question - 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?
Thanks,
Sarath Kumar Daruru