Hi, This is an expected behaviour. After the "ar" event there still may occur other "ar" event that will also trigger a match. To be more generic in all versions prior to 1.3.0 there are two different consuming strategies:
- STRICT (the next operator) - that accepts only if the event occurs directly after the previous - SKIP TILL ANY (the followedBy operator) - it accepts any matching event following event if there were already an event that matched this pattern Because after "ni" event we could match with some other "ar" events, the match is timeouted after 5 seconds. In FLINK-6208 <https://issues.apache.org/jira/browse/FLINK-6208> we introduced third consuming strategy: - SKIP TILL NEXT(this is the strategy for followedBy right now) - the event does not have to occur directly after the previous one but only one event can be matched and you can still use SKIP TILL ANY by using followedByAny. I believe the SKIP TILL NEXT strategy is the one you expected. You can check it on master branch. We did introduce lots of new features and bugfixes to CEP for 1.3.0 version so any comments, tests or suggestions are welcome. Z pozdrowieniami! / Cheers! Dawid Wysakowicz *Data/Software Engineer* Skype: dawid_wys | Twitter: @OneMoreCoder <http://getindata.com/> 2017-04-29 12:14 GMT+02:00 Moiz S Jinia <moiz.ji...@gmail.com>: > When using "next", this pattern works fine for the both a match as well as > a timeout: > > Pattern<Event, Event> pattern = Pattern.<Event>begin("start") > .where(evt -> evt.value.equals("ni")) > .next("last").where(evt -> evt.value.equals("ar")). > within(Time.seconds(5)); > > 1. "ni" then "ar" within 5 seconds - triggers match > 2. "ni" then no "ar" within 5 seconds - triggers timeout > > But with "followedBy", this does not behave as expected: > > Pattern<Event, Event> pattern = Pattern.<Event>begin("start") > .where(evt -> evt.value.equals("ni")) > .followedBy("last").where(evt -> evt.value.equals("ar")). > within(Time.seconds(5)); > > "ni" then "ar" within 5 seconds - triggers match and also triggers timeout. > > Why is the timeout triggered when using followedBy (when there is a match)? > > Version - 1.1.5. >