[rules-users] Accumulate function, events and stream processing
Juanker Atina
juankera at gmail.com
Mon Jan 30 12:03:51 EST 2012
I need your help to put to work an accumulate function.
So, i will introduce several facts into working memory (StateEvent, which i
declare as event) and i want to accumulate the last five values.
I have changed a property in drools.default.rulebase.conf
(drools.eventProcessingMode = STREAM) to make the engine works in stream
mode.
And my rule is:
declare StateEvent
@role( event )
end
rule "Testing"
when
$total : Number() from accumulate(
StateEvent(itemName=="Temperatura", $val : newState) over
window:length( 5 ),
sum ( ((DecimalType)$val).toBigDecimal().doubleValue() ) )
then
#actions
end
But it's not working, as the value of $total is 0.0, no matter what i do,
and the rule is firing with every fact in the working memory.
Any help will be appreciated.
Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20120130/2e1d7d4a/attachment.html
More information about the rules-users
mailing list