Esper:注意,当事件数量(具有特定参数)超过阈值时
寻找解决方案已经很长时间了:
我有一个联系表。每次有人通过它发送邮件时,都会向 Esper 发出 ContactEvent(receiver, senderIpAddress)。现在,当特定 IP 地址在 10 分钟内发出超过 50 个联系事件时,我希望 Esper 通知我。
下面代码中的语法错误是由于代码简化造成的
create window ContactWindow.win:time(10 min) as select ipAddress, mail from ContactEvent
,然后我像这样填充它:
insert into ContactWindow select ipAddress, mail from ContactEvent";
最终,有一个类似这样的事件侦听器:
select ip, count(ip) as cnt from ContactWindow group by ip
这实际上有效。这并不完全是我想要的,因为每次发出我的语句侦听器时,IP 地址的消息计数都会发生变化。 (“IP X 在过去 10 分钟内发送了 43 条消息”,“IP X 在过去 10 分钟内发送了 44 条消息”,...) 我只想让一个事件告诉我“IP X 在过去 10 分钟内超过 50 条消息”,另一个事件告诉我,它现在已经低于该边界。
有办法让它发挥作用吗?
searching for a solution for this quite a long time:
I have a contact form. Every time somebody sends a mail through it, a ContactEvent(receiver, senderIpAddress) is issued to Esper. Now, I would like Esper to inform me, when a specific Ip Address issues more than 50 contact events in 10 minutes.
Syntax Errors in code below are due to code simplification
create window ContactWindow.win:time(10 min) as select ipAddress, mail from ContactEvent
then I populate it like this:
insert into ContactWindow select ipAddress, mail from ContactEvent";
Eventually, there is an eventlistener on something like this:
select ip, count(ip) as cnt from ContactWindow group by ip
Which actually works. It's not exactly what I would want tough, as my statement listener is issued each time, an ip addresse's message count changes. ("IP X has sent 43 messages the last 10 minutes", "IP X has sent 44 messages the last 10 minutes",...)
I'd only like to get one event telling me "IP X is over 50 messages in the last 10 minutes" and another one telling me, that it has dropped below that border now.
Is there a way to get this to work?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
也许添加 having 子句。在你的例子中
Maybe add a having clause. In your example