1. I'm setting the stream mode to work with events (kbaseConfig.setOption( EventProcessingOption.STREAM )
2. I have a simple DRL file
declare StateEvent
@role( event )
end
rule "Test"
when
Number($total : doubleValue) from accumulate(
StateEvent(itemName=="Temperatura", $val : newState) over window:length( 5 ) from entry-point "EventStream",
average ( ((DecimalType)$val).toBigDecimal().doubleValue() ) )
then
System.out.println("" + $total);
end
3. I insert a fact into working memory (entry point "EventStream")
WorkingMemoryEntryPoint entry = ksession.getWorkingMemoryEntryPoint("EventStream");
entry.insert((RuleEvent) new StateEvent(item, state));
4. Fire rules
5. Repeat steps 3 and 4 to put accumulate and average functions to work
RESULTS WITH 5.2.0 Final
Works nicely, i can see the average updated with every fact inserted.
RESULTS WITH 5.3.0 Final
It returns the same result and average (neither sum or the simplest case count(1)) doesn't work.