I have two different match recognize patterns created in Esper event processing language, when I run these one by one they are working fine but I need to get result from both of these patterns on incoming events. The patterns are defined as below.
(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')
I need to get result when any one of these patterns is matched with incoming events on a single query.
ok so what is the problem? You simple create them both and add a listener to each and its all done.
First example:
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());
Another example:
EPStatement first = epAdministrator.createEPL(...);
first.addListener(new MyUpdateListener());
EPStatement second = epAdministrator.createEPL(...);
second.addListener(new MyUpdateListener());