My code is the following:
StreamExecutionEnvironment env= StreamExecutionEnvironment.getExecutionEnvironment();
DataStream<MyObject> input = env.addSource(new MyCustomSource());
Pattern<MyObject, ?> pattern = Pattern.<MyObject>begin("start");
PatternStream<MyObject> patternStream = CEP.pattern(input, pattern);
... define my pattern
DataStream<MyObject> resultStream = patternStream.select(new MyCustomPatternSelectFunction());
resultStream.addSink(new MyCustomSinkFunction(subscriptionCriteria));
try
{
env.execute();
}
catch (Exception exception)
{
log.debug("Error while ", exception);
}
this code works and does what i want and i get a result stream that follows the pattern i set.
what i want to know is if it is possible to apply new patterns to this source i added to the environment later when i wish and thus getting different result stream matching different patterns without calling env.execute() another time because when i do that in addition to my new result stream i get redundant old result streams (i.e. old patterns get executed multiple times)?