[rules-users] Rule not working with Change_set.xml

anniejoseph chithraannie at gmail.com
Thu Oct 18 01:13:57 EDT 2012


Hi,

   Thanks for your replay.
   I tried the way you said and my rule got executed.But there is some
problems.

   1) My rule worked only one time with ' insert(); ' .My rule is

import java.util.List;
import java.util.ArrayList;

rule "Set Art"   
 no-loop true	
 when           
       $object   : object()   
       $Value : Value($th: test, $Type : Type, $Id : Id,$Name : test.Name
,test.Name == "CPU Usage(%)" ) 	    
             from $metric.metrics        		
       not  Art( testSettingId == $testId )	    
 then   
       System.out.println(" Change-set.xml  ");
       Art art = new Art(); 	
       art.setMetric($Value); 
       art.setName($Name);
       art.setCount(1);       		 		
       art.setType($Type);  
       art.setObjectId($Id); 
       art.setCurrentTimeMillis(System.currentTimeMillis()); 
       insert(art);
       retract ($object);
 end;

 I tried after removing '  insert(art); ' ,then it worked properly.

  2)When I changed the rule (System.out.println(" test ");) to test the
scanning interval ,the word 'test' printed more than two times at the same
iteration. The same happens every time the rule modifies.

Can you help me in this.

 Thanks.




--
View this message in context: http://drools.46999.n3.nabble.com/Rule-not-working-with-Change-set-xml-tp4020313p4020358.html
Sent from the Drools: User forum mailing list archive at Nabble.com.


More information about the rules-users mailing list