I'm monitoring the movement of vehicles. Whenever they enter or exit a geofence, an event is triggered. Via Flink I want to check whether a vehicle was within a fence for at least 2 hours.
Here's the pattern I'm using:
begin("enter").notFollowedBy("exit").within(Time.hours(2)).followedBy("final-exit")
The thing is: the partial "enter" match stays valid even if the notFollowed "exit" is true, i.e. if the vehicle returns a couple of days later and triggers another exit-Fence event, it gets pass the notFollowedBy-rule and results in a complete match.
Is there a way to tell Flink to discard a partial match actively?