[英]Variabes in Drools
無法在規則2的條件下使用變量,其中在規則1中設置相同變量的值,該規則在規則2的執行之前觸發。以下是規則
rule "Rule1"
no-loop true
lock-on-active true
salience 1000
when
$ExeMode: Module( event.type in ("summer", "spring"))
then
$ExeMode.getEvent().setStatus("Available");
System.out.println($ExeMode.getEvent().getStatus());
update($ExeMode);
rule "Rule2"
no-loop true
lock-on-active true
salience 999
when
$Mod: Module( event.status in ("Available", "NotAvailable"))
then
$Mod.getEvent().setResult("Booked");
狀態變量在rule1中設置,並且能夠在其中打印值。
當我使用相同的變量作為rule2中的條件。 然后rule2沒有開火。 請建議。
您在規則中使用了lock-on-active
屬性,這意味着您的規則的RHS不會觸發新的激活。
希望能幫助到你,
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.