Re: CEP condition expression and its event consuming strategy

2017-08-03 Thread Chao Wang
Thank you, Dawid. FYI, I've implemented the discarding logic by CoFlatMapFunction, for the special case where there are only two input streams: I maintain a logical state (no match, input1 matched, or input2 matched) and use private variables to store the matched event so far, which waits to be

Re: CEP condition expression and its event consuming strategy

2017-07-31 Thread Dawid Wysakowicz
Ad. 1 Yes it returns and Iterable to support times and oneOrMore patterns(which can accept more than one event). Ad. 2 Some use case for not discarding used events could be e.g. looking for some shapes in our data, e.g. W-shapes. In this case one W-shape could start on the middle peak of the p

Re: CEP condition expression and its event consuming strategy

2017-07-28 Thread Chao Wang
Hi Dawid, Thank you. Ad. 1 I noticed that the method getEventsForPattern() returns an Iterable and we need to further invoke .operator().next() to get access to the event value. Ad. 2 Here is a bit about a use case we have that calls for such discarding semantics. In the event processing pr

Re: CEP condition expression and its event consuming strategy

2017-07-27 Thread Dawid Wysakowicz
Hi Chao, Ad. 1 You could implement it with IterativeCondition. Sth like this: Pattern pattern = Pattern.begin("first").where(new SimpleCondition() { @Override public boolean filter(Event value) throws Exception { return value.equals("A") || value.equals("B"); } }).followedBy("seco

CEP condition expression and its event consuming strategy

2017-07-26 Thread Chao Wang
Hi, I have two questions regarding the use of the Flink CEP library (flink-cep_2.11:1.3.1), as follows: 1. I'd like to know how to use the API to express "emit event C in the presence of events A and B, with no restriction on the arriving order of A and B"? I've tried by creating two pattern