Drools规则执行顺序
以堆栈方式执行,优先级低的先入栈,同一优先级的,在规则文件中位置靠前的先入栈.
测试1
rule "test first" salience 0 no-loop false when $test: String( ) then System.out.println($test); insert("test second");endrule "test second" salience -10 when $test: String( ) then System.out.println($test + " the 2nd"); insert("test three");endtesttest secondtest second the 2ndtest threetest three the 2ndtest the 2nd
rule "test first" salience 0 no-loop false when $test: String( ) then System.out.println($test); insert("test second");endrule "test second" salience 0 no-loop false when $test: String( ) then System.out.println($test + " the 2nd"); insert("test three");endtest the 2ndtest three the 2ndtest threetest second the 2ndtest secondtest
rule "test second"salience 0activation-group "show"no-loop truewhen$test: String( )then System.out.println($test);insert("test second");endrule "test first"salience 0activation-group "show"no-loop truewhen$test: String( )then System.out.println($test + " the 2nd");insert("test three");endtest the 2ndtest threetest second the 2nd