Use different functions for different signal values

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

Use different functions for different signal values

Marke Builder
Hi,

I want to implement the following behavior:

image.png
There are a lot of ingest signals with unique Id's, I would use for each signal set a special function. E.g. Signal1, Signal2 ==> function1, Signal3, Signal4 ==> function2.
What is the recommended way to implement this pattern?

Thanks!

Reply | Threaded
Open this post in threaded view
|

Re: Use different functions for different signal values

Ken Krugler
Hi Marke,

You can use DataStream.split() to create a SplitStream, and then call SplitStream.select() to create the three different paths to the three functions.


— Ken

On Apr 2, 2019, at 8:41 AM, Marke Builder <[hidden email]> wrote:

Hi,

I want to implement the following behavior:

<image.png>
There are a lot of ingest signals with unique Id's, I would use for each signal set a special function. E.g. Signal1, Signal2 ==> function1, Signal3, Signal4 ==> function2.
What is the recommended way to implement this pattern?

Thanks!


--------------------------
Ken Krugler
+1 530-210-6378
http://www.scaleunlimited.com
Custom big data solutions & training
Flink, Solr, Hadoop, Cascading & Cassandra

Reply | Threaded
Open this post in threaded view
|

Re: Use different functions for different signal values

Hequn Cheng
Hi Marke,

Ken is right. We can use split and select to achieve what you want.

Besides, I am thinking if there is a lot of ingesting signals with unique Id's, why not use one function and process different logic in the function. For example, we can call different methods in the function according to the value of the input "id field".  This can make the code more simple and generic, IMO. 
Is it because the return types of these functions are different?

Best, Hequn

On Wed, Apr 3, 2019 at 7:17 AM Ken Krugler <[hidden email]> wrote:
Hi Marke,

You can use DataStream.split() to create a SplitStream, and then call SplitStream.select() to create the three different paths to the three functions.


— Ken

On Apr 2, 2019, at 8:41 AM, Marke Builder <[hidden email]> wrote:

Hi,

I want to implement the following behavior:

<image.png>
There are a lot of ingest signals with unique Id's, I would use for each signal set a special function. E.g. Signal1, Signal2 ==> function1, Signal3, Signal4 ==> function2.
What is the recommended way to implement this pattern?

Thanks!


--------------------------
Ken Krugler
+1 530-210-6378
http://www.scaleunlimited.com
Custom big data solutions & training
Flink, Solr, Hadoop, Cascading & Cassandra