I have following case scenario
There are 2 Virtual machines which are sending streams to Kafka which are being received by CEP engine where warnings are generated when particular conditions are satisfied on the individual Stream.
Currently, CEP is checking for same conditions on both streams( when heart rate > 65 and respiration rate > 68) for both patients and raising alarms in Parallel as shown below
// detecting pattern
Pattern<joinEvent, ? > pattern = Pattern.<joinEvent>begin("start")
.subtype(joinEvent.class).where(new FilterFunction<joinEvent>() {
@Override
public boolean filter(joinEvent joinEvent) throws Exception {
return joinEvent.getHeartRate() > 65 ;
}
})
.subtype(joinEvent.class)
.where(new FilterFunction<joinEvent>() {
@Override
public boolean filter(joinEvent joinEvent) throws Exception {
return joinEvent.getRespirationRate() > 68;
}
}).within(Time.milliseconds(100));
But I want to use different conditions for both Streams. For example, I would like to raise alarm if
For patient A : if heart rate > 65 and Respiration Rate > 68
For patient B : if heart rate > 75 and Respiration Rate > 78
How do I achieve this ? do I need to create multiple stream environments or multiple patterns in the same environment.