Search code examples
espereplcomplex-event-processingnesper

How to fire pattern on partial match in Esper CEP


I'm trying to solve route-violation problem. User defines a route as series of location sequences (in exact order) that some item needs to be seen on. So lets say that correct route is (this is defined by user)

A -> B -> C

I'm trying to write Esper EPL which will fire on all route violations. A is a starting point, which needs to start a pattern (a valid location).

A -> !B -> !C

This will fire when there are all 3 types of events found in ESPER.

But what I want is also to fire when there is only partial combination like

A -> !B

or

!B -> !C

or

B -> !C

because if route is missed on B then I'll probably never come to C and will not be notified of route violation.

Is this even possible with patterns in Esper?


Solution

  • I can see a few options.

    • Register a separate statement with a pattern or match-recognize for each
    • Connect each with "or" i.e. "every (..) or every (..) or every (..)
    • Insert the result of a partial match into a stream for another pattern to continue matching
    • I think match-recognize has some resumption options around "skip"