Apache Flink provides a pattern API to apply complex event processing on the data stream. Some important methods are:
- begin: This defines the pattern starting state and can be written as follows:
Pattern<Event, ?> start = Pattern.<Event>begin("start");
- followedBy: This appends a new pattern state but here other events can occur between two matching events as follows:
Pattern<Event, ?> followedBy = start.followedBy("next");
- where: This defines a filter condition for the current pattern state and, if the event passes the filter, it can match the state as follows:
patternState.where(new FilterFunction <Event>() {
@Override
public boolean filter(Event value) throws Exception {
return ... // some condition
}
});
- within: This defines the maximum time interval for an event sequence to match the pattern post that...