The Pattern API allows you to define complex event patterns very easily. Each pattern consists of multiple states. To go from one state to another state, generally we need to define the conditions. The conditions could be continuity or filtered out events.
Let's try to understand each pattern operation in detail.
The initial state can be defined as follows:
In Java:
Pattern<Event, ?> start = Pattern.<Event>begin("start");
In Scala:
val start : Pattern[Event, _] = Pattern.begin("start")
We can also specify the filter condition for the initial state:
In Java:
start.where(new FilterFunction<Event>() { @Override public boolean filter(Event value) { return ... // condition } });
In Scala:
start.where(event => ... /* condition */)