i have a class called Event which has the following members { name, source, timestamp } with getters ,setters and constructor. i have a rule file which creates Event objects whenever a file is added / deleted in a particular folder. the rule file is as follows
rule "new file" when $p: RuleContext( $old : getOldContext().getContainedFiles(), $new :getNewContext().getContainedFiles()) RuleContext( $old != $new) accumulate( $s : Object( this not memberOf $old ) from $new, $plus : collectList( $s ) ) events : Object() from $plus; then Event event = new Event("new file added",$p.getOldContext().getParent(),new Date()); end rule " file deleted" when $p: RuleContext( $old : getOldContext().getContainedFiles(), $new:getNewContext().getContainedFiles()) RuleContext( $old != $new) accumulate( $t : Object( this not memberOf $new ) from $old, $mins : collectList( $t ) ) events : Object() from $mins; then Event event = new Event("file deleted",$p.getOldContext().getParent(),new Date()); end (do not confuse with RuleContext and other unknown identifiers.. they r just related with other classes in the project.. these two rules just works fine )..i need to use a sliding time window and create another event if the number of file additions are > 5 over the past 1 minute. my rule file is : declare Event @role( event ) end rule "More than 5 additions" when Number(intValue > 5) from accumulate( $tick : Event ( name == "new file added" ) over window:time( 1m ), count( $tick ) ) ) then System.out.println("too many additions"); end i have enabled stream mode processing too.. but it doesnt seem to work. what could be the problem?
_______________________________________________ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users