私は Drools Fusion を初めて使用し、ルールが常に実行されるとは限らない理由を理解しようとしています。Drools 6.3 を使用しています。これらは私が挿入しているイベントです:
private static void initMessageObject() {
SessionPseudoClock clock = ksession.getSessionClock();
hellodrools2.AppInfo app = new hellodrools2.AppInfo();
entryPoint1.insert(app);
System.out.println(app);
Steps step1 = new Steps(25, 0);
entryPoint1.insert(step1);
clock.advanceTime(30, TimeUnit.MINUTES);
Steps step2 = new Steps(15, 0);
entryPoint1.insert(step2);
clock.advanceTime(15, TimeUnit.MINUTES);
Steps step3 = new Steps(25, 0);
entryPoint1.insert(step3);
try {
System.err.println("[[ Sleeping ...]]");
Thread.sleep(5000);
} catch (final InterruptedException e) {
e.printStackTrace();
}
System.err.println("[[ awake ...]]");
ksession.halt();
ksession.dispose();
}
そして、これは私のルールファイルです:
import hellodrools.Steps
import hellodrools.AppInfo
declare Steps
@role(event)
end
rule "STEPS RULE"
when
$totalSteps : Number( doubleValue < 50 ) from accumulate(
Steps( stepsCount : steps ) over window:time( 1h ) from entry-point
entryone, sum( stepsCount ) )
then
System.out.println("STEPS RULE: get moving!");
System.out.println($totalSteps);
end
これは私の出力です:
AppInfo{startTime=Sat Feb 27 21:30:42 CET 2016}
[[ Sleeping ...]]
STEPS RULE: get moving!
0.0
[[ awake ...]]
ルールが 2 回実行され、次の出力が得られると予想します。
AppInfo{startTime=Sat Feb 27 21:30:42 CET 2016}
[[ Sleeping ...]]
STEPS RULE: get moving!
25.0
STEPS RULE: get moving!
40.0
[[ awake ...]]
私はおそらくいくつかを見落としていますが、私の問題に関する情報はあまり見つかりませんでした。誰かがここで何が起こっているのか正確に説明できますか? ありがとうございました。