Esper 规则语言:来自模式的 class 的 return 数据字段
Esper rule language: return datafield of class from pattern
我有以下规则,当心率保持在 160 以上 5 分钟时触发。
EPStatement cepStatementRule3 = cepRule.createEPL("context PartitionByMacHeartRate "
+ "select * from pattern[every(HeartRate(heartrate > 160) "
+ "-> (timer:interval(5 min) "
+ "and not HeartRate(heartrate<=160)))]");
cepStatementRule3.addListener(new rule3Listener());
我的心率 class 有以下字段:
int heartrate;
String heartratesTimestamp;
String macAddress;
我想要的是能够在我的 ruleListener 中获取 macAddress。然而这
returns 是一个空的 hashmap。所以我的问题是如何 return HeartRate 的 macAddress?
模式保留并return标记的事件,即这样做:
// we assign the 'h' tag to the first event and the engine now retains that
// the select clause could use "h.macAddress as macAddress", for example
...every(h=HeartRate(...
我有以下规则,当心率保持在 160 以上 5 分钟时触发。
EPStatement cepStatementRule3 = cepRule.createEPL("context PartitionByMacHeartRate "
+ "select * from pattern[every(HeartRate(heartrate > 160) "
+ "-> (timer:interval(5 min) "
+ "and not HeartRate(heartrate<=160)))]");
cepStatementRule3.addListener(new rule3Listener());
我的心率 class 有以下字段:
int heartrate;
String heartratesTimestamp;
String macAddress;
我想要的是能够在我的 ruleListener 中获取 macAddress。然而这 returns 是一个空的 hashmap。所以我的问题是如何 return HeartRate 的 macAddress?
模式保留并return标记的事件,即这样做:
// we assign the 'h' tag to the first event and the engine now retains that
// the select clause could use "h.macAddress as macAddress", for example
...every(h=HeartRate(...