flink-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Philip Limbeck <philiplimb...@gmail.com>
Subject Flink CEP State Change Pattern
Date Sat, 14 Oct 2017 12:54:33 GMT
Hi!

I am quite new to Flink CEP and try to define a state change pattern
with it. This means that only discrete changes in the event stream
should be detected i.e.

a a b b - triggers a single change from a to b

Considering b the "bad" state, I would like to additionally recognize
the state change from null (i.e. non-existing state) to b:

b b b - triggers a single change from null to b

Initially, I tried to model this behavior as follows:

Pattern<...>begin("first")
.where(<detectStateA>)
.optional()
.next("second")
.where(<detectStateB>)

However, since state b can be detected without state a, having a state
change from a to b results in two identified patterns:
a b
and
b

Additionally, when the "bad" state b is already given, every
subsequent b event will detect a new b pattern which is also not what
I want.

When the "optional" keyword is omitted, obviously no initial b events
are detected.

I know that Flink 1.4.0 will support AFTER_MATCH_SKIP, which I assume
would aid in this situation as a single b event will not take part in
two computation states.

Being currently stuck with 1.3.2 is there a workaround using Flink CEP
to enable this behavior?

I am aware of the fact that this behavior is much easier to build
using plain Flink.

Thank you for your support, any help is appreciated.

Best
Philip

Mime
View raw message