Questions about the FlinkCEP

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Questions about the FlinkCEP

Esa Heikkinen-2

Hi

I have tried to learn FlinkCEP [1], but i have yet not found the clear answers for questions:

1) Whether the pattern of CEP is meant only for one data stream at the same time ?

2) If i have many different parallel data streams (or sources), should i combine them into one data stream (and is this possible ?), if i want to use same CEP pattern for all parallel streams at the same time ?

3) What is the format of data stream of events for CEP ?

4) Can i directly supply a data stream from env.socketTextStream() to CEP ?

5) Can one event in stream include many "attributes" and values ? Or is it only key-value-pair ? Timestamp of event ?

6) Can CEP save the found values of events for use in later "steps" ? For example in pattern:

val pattern = Pattern.begin("start").where(_.getId == 42)
  .next("middle").subtype(classOf[SubEvent]).where(_.getVolume >= 10.0)
  .followedBy("end").where(_.getName == "end")

Whether value of Id in"start"-step can be saved and check whether it (Id) is same in "end"-step ?

[1] https://ci.apache.org/projects/flink/flink-docs-release-1.4/dev/libs/cep.html

Best, Esa

Reply | Threaded
Open this post in threaded view
|

Re: Questions about the FlinkCEP

Kostas Kloudas
Hi Esa,

The answers to the questions are inlined.

On Feb 28, 2018, at 8:32 PM, Esa Heikkinen <[hidden email]> wrote:

Hi

I have tried to learn FlinkCEP [1], but i have yet not found the clear answers for questions:
1) Whether the pattern of CEP is meant only for one data stream at the same time ?
Yes.
2) If i have many different parallel data streams (or sources), should i combine them into one data stream (and is this possible ?), if i want to use same CEP pattern for all parallel streams at the same time ?

Yes you should somehow combine them. This can be done with .union if this is ok for you logic but 
how to do it depends on your job. Or you can just apply the same pattern to all your streams and then
union the result into a single output stream.

3) What is the format of data stream of events for CEP ?

The input can be an arbitrary data stream.



4) Can i directly supply a data stream from env.socketTextStream() to CEP ? 

Yes. Why don’t you try it out ;)

5) Can one event in stream include many "attributes" and values ? Or is it only key-value-pair ? Timestamp of event ?

An event can have arbitrary format. It is up to you to interpret your data.

6) Can CEP save the found values of events for use in later "steps" ? For example in pattern:

val pattern = Pattern.begin("start").where(_.getId == 42)

  
.next("middle").subtype(classOf[SubEvent]).where(_.getVolume >= 10.0)

  
.followedBy("end").where(_.getName == "end")
Whether value of Id in"start"-step can be saved and check whether it (Id) is same in "end"-step ?


If I get the question right, you can do it with Iterative conditions, as described in the documentation.

[1] https://ci.apache.org/projects/flink/flink-docs-release-1.4/dev/libs/cep.html

Best, Esa

Best,
Kostas

Reply | Threaded
Open this post in threaded view
|

RE: Questions about the FlinkCEP

Esa Heikkinen

 

Hi

 

6) I meant that in the first step the CEP pattern queries value for “Id” and stores the value to (global) variable for later use in the same pattern or even other places in the application. Is this possible ?

 

Best, Esa

 

From: Kostas Kloudas [mailto:[hidden email]]
Sent: Thursday, March 1, 2018 11:35 AM
To: Esa Heikkinen <[hidden email]>
Cc: [hidden email]
Subject: Re: Questions about the FlinkCEP

 

Hi Esa,

The answers to the questions are inlined.


On Feb 28, 2018, at 8:32 PM, Esa Heikkinen <[hidden email]> wrote:

Hi

I have tried to learn FlinkCEP [1], but i have yet not found the clear answers for questions:
1) Whether the pattern of CEP is meant only for one data stream at the same time ?

Yes.

2) If i have many different parallel data streams (or sources), should i combine them into one data stream (and is this possible ?), if i want to use same CEP pattern for all parallel streams at the same time ?


Yes you should somehow combine them. This can be done with .union if this is ok for you logic but 

how to do it depends on your job. Or you can just apply the same pattern to all your streams and then

union the result into a single output stream.



3) What is the format of data stream of events for CEP ?

 

The input can be an arbitrary data stream.

 




4) Can i directly supply a data stream from env.socketTextStream() to CEP ? 

 

Yes. Why don’t you try it out ;)



5) Can one event in stream include many "attributes" and values ? Or is it only key-value-pair ? Timestamp of event ?

 

An event can have arbitrary format. It is up to you to interpret your data.



6) Can CEP save the found values of events for use in later "steps" ? For example in pattern:

val pattern = Pattern.begin("start").where(_.getId == 42)

 

  

.next("middle").subtype(classOf[SubEvent]).where(_.getVolume >= 10.0)

 

  

.followedBy("end").where(_.getName == "end")
Whether value of Id in"start"-step can be saved and check whether it (Id) is same in "end"-step ?

 

If I get the question right, you can do it with Iterative conditions, as described in the documentation.



[1] https://ci.apache.org/projects/flink/flink-docs-release-1.4/dev/libs/cep.html

Best, Esa

 

Best,

Kostas

Reply | Threaded
Open this post in threaded view
|

Re: Questions about the FlinkCEP

Kostas Kloudas
Hi, 

So yes you can do it with IterativeConditions.

Cheers,
Kostas


On Mar 1, 2018, at 1:15 PM, Esa Heikkinen <[hidden email]> wrote:

 
Hi
 
6) I meant that in the first step the CEP pattern queries value for “Id” and stores the value to (global) variable for later use in the same pattern or even other places in the application. Is this possible ?
 
Best, Esa
 
From: Kostas Kloudas [[hidden email]] 
Sent: Thursday, March 1, 2018 11:35 AM
To: Esa Heikkinen <[hidden email]>
Cc: [hidden email]
Subject: Re: Questions about the FlinkCEP
 
Hi Esa,

The answers to the questions are inlined.


On Feb 28, 2018, at 8:32 PM, Esa Heikkinen <[hidden email]> wrote:

Hi

I have tried to learn FlinkCEP [1], but i have yet not found the clear answers for questions:
1) Whether the pattern of CEP is meant only for one data stream at the same time ?
Yes.

2) If i have many different parallel data streams (or sources), should i combine them into one data stream (and is this possible ?), if i want to use same CEP pattern for all parallel streams at the same time ?

Yes you should somehow combine them. This can be done with .union if this is ok for you logic but 
how to do it depends on your job. Or you can just apply the same pattern to all your streams and then
union the result into a single output stream.


3) What is the format of data stream of events for CEP ?
 
The input can be an arbitrary data stream.
 



4) Can i directly supply a data stream from env.socketTextStream() to CEP ? 
 
Yes. Why don’t you try it out ;)


5) Can one event in stream include many "attributes" and values ? Or is it only key-value-pair ? Timestamp of event ?
 
An event can have arbitrary format. It is up to you to interpret your data.


6) Can CEP save the found values of events for use in later "steps" ? For example in pattern:

val pattern = Pattern.begin("start").where(_.getId == 42)
 
  
.next("middle").subtype(classOf[SubEvent]).where(_.getVolume >= 10.0)
 
  

.followedBy("end").where(_.getName == "end")
Whether value of Id in"start"-step can be saved and check whether it (Id) is same in "end"-step ?

 
If I get the question right, you can do it with Iterative conditions, as described in the documentation.


 
Best,

Kostas