Hi Puneet,

Sorry I'm not be an expert for CEP, but the underlying implementation of the 
CEP should
be based on the NFA, and from the API documentation, `followedBy` does not 
require the
two patterns are adjacent (namely the give pattern also accepts ['a', 'c', 
'b']. Thus when
recieved 'a', I think the NFA might have two possible transitions, one is to 
accept 'b'
and get a match, another one is to ignore 'b' and waiting for the following 
events, thus
the condition might be eval for two times.

Best,
Yun



 ------------------Original Mail ------------------
Sender:Schwalbe Matthias <matthias.schwa...@viseca.ch>
Send Date:Wed Oct 27 17:55:18 2021
Recipients:Puneet Duggal <puneetduggal1...@gmail.com>, user 
<user@flink.apache.org>
Subject:RE: Duplicate Calls to Cep Filter

Hi Puneet,

…  not able to answer your question, but I would be curious to also print out 
the value with your diagnostic message.
… assuming we’ll see an ‘a’ and a ‘b’ for both filters resp.

… simple explanation would be that the filters are applied to all input, 
regardless of the pattern matching that follow the input filtering (just 
guessing)

Thias


From: Puneet Duggal <puneetduggal1...@gmail.com>
Sent: Mittwoch, 27. Oktober 2021 11:12
To: user <user@flink.apache.org>
Subject: Duplicate Calls to Cep Filter
Hi,
I am facing an issue where a single event is causing execution of a cep filter 
multiple times. I went through this video explaining automata formation from 
pattern sequence but it still does not explain the behaviour that I am facing. 
Following is the sample pattern for whichI am testing this behaviour.
Pattern<String, ?> innerPattern =
                Pattern
                        .<String>begin("start")
                            .where(new SimpleCondition<String>() {
                                @Override
                                public boolean filter(String value) throws 
Exception {
                                    System.out.println("In the beginning");
                                    return value.equals("a");
                                }
                            })
                        .followedBy("middle")
                            .where(new SimpleCondition<String>() {
                                @Override
                                public boolean filter(String value) throws 
Exception {
                                    System.out.println("In the middle");
                                    return value.equals("b");
                                }
                            });
On passing events a and b to this pattern.. result is
1> a
In the beginning
1> b
In the middle
In the middle
In the beginning
Matched
3> {start=[a], middle=[b]}
As you can see ... on ingestion of b middle pattern is getting called twice. 
Any ideas of this behaviour.

Thanks and regards,
Puneet DuggalDiese Nachricht ist ausschliesslich für den Adressaten bestimmt 
und beinhaltet unter Umständen vertrauliche Mitteilungen. Da die 
Vertraulichkeit von e-Mail-Nachrichten nicht gewährleistet werden kann, 
übernehmen wir keine Haftung für die Gewährung der Vertraulichkeit und 
Unversehrtheit dieser Mitteilung. Bei irrtümlicher Zustellung bitten wir Sie um 
Benachrichtigung per e-Mail und um Löschung dieser Nachricht sowie eventueller 
Anhänge. Jegliche unberechtigte Verwendung oder Verbreitung dieser 
Informationen ist streng verboten.

This message is intended only for the named recipient and may contain 
confidential or privileged information. As the confidentiality of email 
communication cannot be guaranteed, we do not accept any responsibility for the 
confidentiality and the intactness of this message. If you have received it in 
error, please advise the sender by return e-mail and delete this message and 
any attachments. Any unauthorised use or dissemination of this information is 
strictly prohibited.

Reply via email to