On 04/12/2013, ters <ters(a)ukr.net> wrote:
laune, thanks for explanations.
Could you please provide me with links/examples of how to /write your own
accumulate function (using the
init/action/result paradigm) /, and how to use this custom function instead
of standard one?
rule manacc
when
Number( $avg: intValue )
from accumulate( Event( $source: source, $value: value),
init( int sum = 0; int count = 0; )
action( if( "server1".equals( $source ) ){
sum += $value; count++;
} )
result( count != 0 ? sum/count : 0 ) )
then
System.out.println("$events avg value = " + $avg );
end
You could add a
reverse( if( "server1".equals( $source ) ){
sum -= $value; count--;
})
Cheers
Wolfgang
Regards!
--
View this message in context:
http://drools.46999.n3.nabble.com/CEP-accumulate-unclear-behavior-tp40270...
Sent from the Drools: User forum mailing list archive at
Nabble.com.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users