drl文件中定義
package com.sample
declare Activity
@role( event )
@timestamp(txTime)
end
rule "totaltimessrule"
salience 1
when
$account:Account($accountnumber:accountnumber) from entry-point ActivityStream
$totaltimes:Number(intValue >= 20)from accumulate(
$Activity:Activity() over window:time(1d) from entry-point ActivityStream, count($Activity))
then
System.out.println($accountnumber);
System.out.println(drools.getRule().getName());
end
然後在java代碼中插入的Activity的txtime(規則引擎的時間戳)全爲 2011-6-1
時鐘採用realtime實時時鐘,執行時間爲2011-6-7
採用滑動窗口over window:time(1d)按說應該取自實時時鐘2011-6-7當天數據作爲活動窗口數據,也就是說沒有數據,按說將不會觸發該規則,爲啥觸發了呢,而且每次執行結果具有不確定性