[rules-users] Re: [rules-dev] Rule is firing on those objects for which that has already fired

Mark Proctor mproctor at codehaus.org
Wed Jun 18 11:01:14 EDT 2008


Do not spam both user and dev mailing lists. This is a user question, 
contain it there.
Details on how to better use the mailing lists are here 
http://labs.jboss.org/drools/lists.html

Mark
siddhartha banik wrote:
>  
> Hi All,
>  
> I am using Drools Stateful session with serialized Rule Base & Working 
> memory for my application. I need to write some rule which will *only* 
> fire on newly inserted data points in Working Memory. Does Drools 
> support any such feature which will help me to achieve this ? Any 
> suggestion, how can I achieve this efficiently?
>  
>  
> As sample, I have written a rule bellow:
>
> global RuleSetOutput ruleSetOutput
>
>  rule "sample_rule"
>  when
>           (p4: DataObject(id == 4, stringValue == "230007014")) and
>           (p14: DataObject(id == 14, stringValue == "230007004")) and
>           (p10: DataObject(id == 10, stringValue == "230007005")) and
>           (p11: DataObject(id == 11, stringValue == "230007006")) and
>           (p12: DataObject(id == 12, stringValue == "230007007")) and
>           (p13: DataObject(id == 13, stringValue == "230007008"))
>  then
>           String ruleID = "sample_rule";
>           RuleOutput ruleOutput = 
> RuleEngineHelper.getRuleOutput(ruleSetOutput, ruleID);
>           ruleOutput.addDataObject(p13);
>           ruleOutput.addDataObject(p4);
>           ruleOutput.addDataObject(p11);
>           ruleOutput.addDataObject(p14);
>           ruleOutput.addDataObject(p10);
>           ruleOutput.addDataObject(p12);
> end
>  
> For 1st execution, I am inserting 6 matching DataObjects into Working 
> Memory. Rule is getting fired once & those 6 data points are getting 
> added into RuleOutput.
>  
> But in subsequent rule executions after I insert 6 more matching 
> DataObjects into Working Memory, Rule is getting fired couple of 
> times  & objects from old executions also getting appended to the 
> current RuleOutput.
>  
> How can I avoid this ?
>  
> Regards
> Siddhartha
>  
>  
> ------------------------------------------------------------------------
>
> _______________________________________________
> rules-dev mailing list
> rules-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-dev
>   

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20080618/74cea5e6/attachment.html 


More information about the rules-users mailing list