espereplcomplex-event-processing

EPL pattern to match latest A and all Bs with filter


I am trying to find an EPL pattern that will match the latest A followed by any & all B(prop1=A.prop1).

Using the same sequence as defined in Esper's documentation...

A1   B1   C1   B2   A2   D1   A3   B3   E1   A4   F1   B4

I am looking for a pattern that will match {A1,B1} {A1,B2} {A3,B3} {A4,B4} assuming that they all have the same prop1 values.

So to be precise, after the first match I do not want the pattern matcher to restart and look for the next A event.

Any help gratefully received!


Solution

  • Having run some tests around this, it turns out that the answer is a filtered version of the every A -> every B as already included in the Esper samples...

    select * from pattern [every a=A -> every b=B(prop1 = a.prop1) and not A(prop1=a.prop1)]