首页 > 代码库 > Esper epl语句实验
Esper epl语句实验
all,snapshot,first
String epl = "select * from appTable.win:time(5 sec) output all every 2 seconds"; 能够看到。输出时将事件从队列中移除。已经输出的下次不再输出。
================ newEventName:appTable name:0 age:0 newEventName:appTable name:1 age:1 ================ newEventName:appTable name:2 age:2 newEventName:appTable name:3 age:3 ================ newEventName:appTable name:4 age:4 newEventName:appTable name:5 age:5 ================
String epl = "select * from appTable.win:time(5 sec) output snapshot every 2 seconds"; 输出的是快照,事件不从队列中移除。 ================ newEventName:appTable name:0 age:0 newEventName:appTable name:1 age:1 newEventName:appTable name:2 age:2 ================ newEventName:appTable name:0 age:0 newEventName:appTable name:1 age:1 newEventName:appTable name:2 age:2 newEventName:appTable name:3 age:3 newEventName:appTable name:4 age:4 ================ newEventName:appTable name:2 age:2 newEventName:appTable name:3 age:3 newEventName:appTable name:4 age:4 newEventName:appTable name:5 age:5 ================
String epl = "select * from appTable.win:time(5 sec) output first every 2 seconds"; 仅仅输出进入窗体的第一条数据。================ newEventName:appTable name:0 age:0 ================ newEventName:appTable name:3 age:3 ================ newEventName:appTable name:5 age:5 ================ newEventName:appTable name:7 age:7 ================
insert前后的时间窗体
String epl2 = "insert into appTable2 select t.id as id, t.price as price from appTable.win:time(5 sec) as t output all every 1 seconds"; String epl3 = "select * from appTable2.win:time(5 sec) output all every 5 seconds"; 为epl3配置监听。 能够看到。第一个5秒就有输出。第1秒 第2秒 第3秒 第4秒 第5秒 newEventName:appTable2 name:0 age:0 newEventName:appTable2 name:1 age:1 newEventName:appTable2 name:2 age:2 newEventName:appTable2 name:3 age:3 newEventName:appTable2 name:4 age:4 ================ 第6秒 第7秒 第8秒 第9秒 第10秒 newEventName:appTable2 name:5 age:5 newEventName:appTable2 name:6 age:6 newEventName:appTable2 name:7 age:7 newEventName:appTable2 name:8 age:8 newEventName:appTable2 name:9 age:9 ================ 第11秒
String epl2 = "insert into appTable2 select t.id as id, t.price as price from appTable.win:time(5 sec) as t output all every 5 seconds"; String epl3 = "select * from appTable2.win:time(5 sec) output all every 5 seconds"; 为epl3配置监听。 能够看到,第二个5秒才有输出。第1秒 第2秒 第3秒 第4秒 第5秒 第6秒 第7秒 第8秒 第9秒 newEventName:appTable2 name:0 age:0 newEventName:appTable2 name:1 age:1 newEventName:appTable2 name:2 age:2 newEventName:appTable2 name:3 age:3 newEventName:appTable2 name:4 age:4 ================ 第10秒 第11秒
Esper epl语句实验