我在Esper事件处理语言中创建了两个不同的匹配识别模式,当我逐个运行它们时它们正常工作但我需要从传入事件中获取这两个模式的结果。模式定义如下。
(1)
match_recognize( "
measures A as a, B as b "
pattern (A B) "
define "
A as A.scene= 'stock'and A.activity='assembly' and A.task='picking' and A.mod2='FT' and A.mod3='Scn',
B as B.scene='stock' and B.activity='assembly' and B.task='picking' and B.mod2='PG' and B.mod3='GzS')
(2)
match_recognize(
measures A as a, B as b, C as c
pattern (A B C)
define
A as A.scene= 'assembly'and A.activity='assembly' and A.task='moving' and A.mod2='GrS' and A.mod3='GzS',
B as B.scene='assembly' and B.activity='assembly' and B.task='moving' and B.mod2='GrT' and B.mod3='Follow',
C as C.scene='assembly' and C.activity='assembly' and C.task='moving' and C.mod2='GrT' and C.mod3='GzS')
当任何一个模式与单个查询中的传入事件匹配时,我需要获得结果。
答案 0 :(得分:0)
第一个例子:
String epl = "@name('first') select ... from ...;\n";
epl += "@name('second') select ... from ...;\n";
epAdministrator.getDeploymentAdmin().parseDeploy(epl);
epAdministrator.getStatement('first').addListener(new MyListener());
epAdministrator.getStatement('second').addListener(new MyListener());
另一个例子:
EPStatement first = epAdministrator.createEPL(...);
first.addListener(new MyUpdateListener());
EPStatement second = epAdministrator.createEPL(...);
second.addListener(new MyUpdateListener());