【发布时间】:2017-04-16 08:03:53
【问题描述】:
我目前正在学习 Drools 并阅读本书Mastering JBoss Drools 6
在第 4 章的开头给出了一个例子来说明 delete 关键字的使用。就是这个例子:
rule "Init current date"
when
then
insert(new Date());
end
rule "Expire coupons"
when
$now: Date()
$cp: Coupon(validUntil before $now)
then
delete($cp);
end
rule "Execute coupon"
when
$o: Order()
$cp: Coupon(order == $o)
then
System.out.println(" We have a coupon for this order!");
end
现在我的问题是:为什么“执行优惠券”规则比“优惠券过期”规则触发得晚。据我所知,规则的顺序是不确定的,所以我认为“执行优惠券”规则可以在其他两个规则之前触发
【问题讨论】: