0
我有多个使用每个发送计步器数据的传感器。我有,基于MACADDRESS规则文件,触发规则:Drools只为插入的事件规则火灾
declare Steps
@role(event)
end
declare User
@role(fact)
end
rule "MAC"
when
User($mac: macAddress) from entry-point "entrySteps"
then end
rule "ACC STEPS RULE" extends "MAC"
when
accumulate(Steps($s : steps , macAddress == $mac)
over window:time(1h) from entry-point "entrySteps";
$fst: min($s), $lst: max($s);
$lst - $fst < 50)
then
System.out.println($lst + " " + $fst);
Action.handleAction($mac,"STEPS RULE: get moving!");
end
我的用户刚刚场macAddress
和步骤事件有以下字段:
double steps;
Date timeStamp;
String macAddress;
现在,当我插入事件然后为每个 macAddress,如果具有该macAddress的用户在最近一小时内的步数小于50,则该规则将触发。因此,如果满足此条件,则该规则将触发每个macAddress。 但我希望规则只能触发插入的Step事件的macAddress。我如何调整我的规则?
@EstebanAliverti也许你可以添加评论确认或否认一个错误?解释这一点的文档参考也很好。 – laune