让我再解释一下。 我有这个cep配置:
{
"host":"http://localhost:1028", //Cepheus CEP
"in":[
{
"id":"A.*",
"type":"Pevent",
"isPattern":true,
"providers":[
"http://localhost:1027" //Cepheus Broker
],
"attributes":[
{ "name":"idEvent", "type":"string" },
{ "name":"endDate", "type":"date" }
]
}
],
"out":[
{
"id":"A",
"type":"Event",
"brokers":[
{
"url":"http://localhost:1026" //orion
}
],
"attributes":[
{ "name":"expired", "type":"int" }
]
}
],
"statements":[
"INSERT INTO Event SELECT idEvent as id, case when endDate<current_timestamp() then 1 else 0 end as expired FROM Pevent OUTPUT all"
]
}
这个配置在cepheus上下文代理中添加或修改新实体时,它会通知cepheus cep和cep计算实体是否过期并将结果发送给orion。这样做没问题。
现在的问题是我需要每小时重新计算一次过期属性(一年365天一天24小时连续),我不知道是否有可能在cep,因为我无法使它工作,找不到任何信息。
提前多多感谢。
答案 0 :(得分:1)
您需要第二条规则来检测过期事件。
您可以使用Esper Patterns检测某段时间内发生不的事件:
SELECT e.id as id, 1 as expired FROM pattern[every e=Pevent -> (timer:interval(1 hour) and not Pevent(id = e.id)]