osdir.com

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Dynamical Windows


Sorry, the KeySelector's Java doc is here : https://ci.apache.org/projects/flink/flink-docs-master/api/java/org/apache/flink/api/java/functions/KeySelector.html

2018-08-01 23:57 GMT+08:00 vino yang <yanghua1127@xxxxxxxxx>:
Hi antonio,

The keyBy API can accept a KeySelector [1] which is a interface you can implement to specify the key for your business.

I think you can use it and implement its getKey method. In the method, you can access outer system (such as Zookeeper) to get a dynamic key.

It's just an idea, you can try it.

Thanks, vino.


2018-08-01 23:46 GMT+08:00 antonio saldivar <ansale10@xxxxxxxxx>:
Hello

I am developing a Flink 1.4.2 application currently with sliding windows (Example below)
I want to ask if there is a way to create the window time dynamically also the key has to change in some Use Cases and we don't want to create an specific window for each UC

I want to send those values from the front end

SingleOutputStreamOperator<Object> windowed = ObjectDTO

.keyBy("Key")

.timeWindow(Time.minutes(10),Time.minutes(1))

.trigger(new AlertTrigger(env.getStreamTimeCharacteristic()))

.aggregate(new TxnAggregator(), new TxnWindowFn())

.name("TEN_MINUTES_WINDOW")



Thank you
Best Regards