Hello,
I wanted to ask this question in a separate email so as to keep each email to one topic for easier thread following. Let me know if you prefer multiple questions per email next time. I am using Drools fusion basically with some success where I am at this point only running some aggregates and calling some java functions when a running average over the last 1 minute or so drops below a certain value. The sources for those values come from objects I am injecting into memory space, but I am not specifically calling retraction code since it is my understanding that I can set the policy in the rule file for how long to hold objects in memory. So for example I have this rule which simpoly outputs to out when the average goes above 100 for the last 10 items(you can tell I created mine based on the stock ticker). It seems to be working, but I have some questions to ensure I understand before moving forward. So below the "declare MyObject" with assigning it role event with a default expiration of 2 minutes. Is my undertanding correct that fusion will disregard thos objects that are injected without me having to take any other action? Also, in my "show averages" rule below, if I did ont have the "declare MyObject" delcaration with expiration policy set, would fusion automatially throw away MyObjects older than the last 10 based on my rule no longer needing them? If it would, then which takes priority, the expires declaration for MyObject or the no longer needed by my aggregate rule below. I am assuming that the rule would keep them beyond 2 minutes it it was necessary, but is this correct? If the rule as written would not automatically remove objects from memory space, then is there something I could do to tell the rule to do so when it is no longer needed by my aggregate? Thanks, Chris <imports removed> # default dialect for the semantic code will be MVEL dialect "mvel" # tells the engine that a object instance will assume the # role (semantics) of events and that the default retention # policy will be 2 minutes declare MyObject @role( event ) @expires( 2m ) end rule "show averages" when $n : Number( doubleValue > 100 ) from accumulate ( $stat:MyObject($bc: byteCount, srcIPAddress == "10.5.0.4") over window:length(10) from entry-point "MyObject stream", average( $bc ) ) then System.err.println("average: " + $n) end
_______________________________________________ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users