こんにちは、Drools fusion は初めてです。Drools fusion の動作を理解するためにいくつかのサンプル ルールを開発しています。よだれを理解するのに助けが必要です
私のルール:
rule "Sample Rule"
when
$t:Test (num == 10) from entry-point Stream
then
System.out.println($t.str);
end
str
Test はString とnum
Integerを持つクラスです。
テスト オブジェクトを挿入し続けnum
、それらのオブジェクトの合計が 100 を超えたときにイベントを発生させるように、いくつかの相関関係によってイベントを発生させる必要があります: ルール "Your First Rule"
when
$t:Test ($tmp:num) from entry-point Stream //store num's value
($tmp>100) // fire if sum of num's more than 100
then
System.out.println($t.str);
end
私のコードは次のとおりです。
WorkingMemoryEntryPoint entryPoint1=ksession.getWorkingMemoryEntryPoint("Stream")
def eg=new Test()
eg.str="Test"
eg.num=10
EventFactHandle factHandle = (EventFactHandle)entryPoint1.insert(eg)
質問 2: の働きを理解したいfireAllRules()
。オブジェクトを drools ランタイム (エントリーポイントまたはセッション) に挿入するたびに、このメソッドでトリガーする必要がありますか?
私の状況を理解していただければ幸いです。事前に助けてください。