laune, thanks for fast reply! So from point to point: *-- "Are you using 5.4.0?"* Yes, I'm using 5.4.0.Final.
*-- "But you can easily achieve what you want by adding the pattern ServicePerformanceEvent() in front of the accumulate CE."* I've tested this, LHS is: / ServicePerformanceEvent() accumulate(ServicePerformanceEvent(serviceName == "MyService", $thisDuration : duration); $avg : average($thisDuration));/ The result is: -= 1 =- $events avg duration = 2.0 ----------FIRED---------- -= 2 =- $events avg duration = 2.0 ----------FIRED---------- -= 3 =- $events avg duration = 7.0 ----------FIRED---------- $events avg duration = 7.0 ----------FIRED---------- $events avg duration = 7.0 ----------FIRED---------- ---test end--- Now (e.g. in case -3-) rule fires on all already inserted/processed events! but I expect (in case -3-) firing only for last inserting event which is not processed before, that is: -= 1 =- $events avg duration = 2.0 ----------FIRED---------- -= 2 =- $events avg duration = 2.0 ----------FIRED---------- /-= 3 =- $events avg duration = 7.0 ----------FIRED----------/ ---test end--- *--"Can you try with a later version?"* I've just tried with 6.0.0.Final version. Now result of Third rule becomes the same for both fireAllRules and fireUntilHalt tests (good point): /////Third rule: when $event : ServicePerformanceEvent(serviceName == "MyService"); accumulate(ServicePerformanceEvent(serviceName == "MyService", $thisDuration : duration); $avg : average($thisDuration)); then System.out.println("$event.duration = " + $event.duration); System.out.println("$events avg duration = " + $avg); System.out.println("----------FIRED----------"); end / Result: -= 1 =- $event.duration = 2 $events avg duration = 2.0 ----------FIRED---------- -= 2 =- -= 3 =- $event.duration = 2 $events avg duration = 7.0 ----------FIRED---------- $event.duration = 12 $events avg duration = 7.0 ----------FIRED---------- ---test end--- As can see, in case -3-, rule fires 2 times - on already inserted and processed as fact event with duration=2 and on the event with duration=12 which inserted just now and was not processed as fact before. Actually what I want in this case - the rule should fire only on events restricted with serviceName constraint, /*which are not processed as fact/not-fact before (inserted between fireAllRules() calls)*/, but average should be calculated for all existed in wm events considering serviceName constraint. I.e. my expectation for Third rule result is: / -= 1 =- $event.duration = 2 $events avg duration = 2.0 ----------FIRED---------- -= 2 =- *-= 3 =- $event.duration = 12 $events avg duration = 7.0* ----------FIRED---------- ---test end---/ How I can achieve this behavior??? -- View this message in context: http://drools.46999.n3.nabble.com/CEP-accumulate-unclear-behavior-tp4027069p4027088.html Sent from the Drools: User forum mailing list archive at Nabble.com. _______________________________________________ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users