I am new to Flink CEP and have been playing around with the patterns for better understanding of them. I have a simple case of a "begin" & a followedBy". I notice that in the case of followedBy, the same event is looping through it multiple times. What am I missing here?
Pattern match_win = Pattern.begin("first").where(new SimpleCondition() {
public boolean filter(HitDTO hitDTO) throws Exception {
boolean result = false;
if (hitDTO.getHitScore() == 4)
{
System.out.println("First:" + hitDTO + ": " + hitDTO.getHitScore());
result = true;
}
return result;
}
}).followedBy("next").where(new SimpleCondition<HitDTO>(){
public boolean filter(HitDTO hitDTO) throws Exception
{
boolean result = false;
if (hitDTO.getHitScore() == 6)
{
System.out.println("Next:" + hitDTO+ ": " + hitDTO.getHitScore());
result = true;
}
return result;
}
});
I am passing in 4,4,6
Parallelism is set at 1.
StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment().setParallelism(1);
However, this is what I see in the logs for the printout within the patterns, where 6 is looping 4 times when it was passed in only once.
First:com.rs.dto.HitDTO@17619295: 4
First:com.rs.dto.HitDTO@c108f70: 4
Next:com.rs.dto.HitDTO@5d13aab8: 6
Next:com.rs.dto.HitDTO@5d13aab8: 6
Next:com.rs.dto.HitDTO@5d13aab8: 6
Next:com.rs.dto.HitDTO@5d13aab8: 6
Just wondering why the same event is looping through multiple times but the outcome is correct.
Thanks for your answer.