You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@flink.apache.org by antonio saldivar <an...@gmail.com> on 2018/08/01 15:46:32 UTC

Dynamical Windows

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

Re: Dynamical Windows

Posted by antonio saldivar <an...@gmail.com>.
Awesome, thank you very much I will try to do it with key selector to send
the key from the front end

El mié., 1 ago. 2018 a las 11:57, vino yang (<ya...@gmail.com>)
escribió:

> 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 <ya...@gmail.com>:
>
>> 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 <an...@gmail.com>:
>>
>>> 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
>>>
>>
>>
>

Re: Dynamical Windows

Posted by vino yang <ya...@gmail.com>.
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 <ya...@gmail.com>:

> 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 <an...@gmail.com>:
>
>> 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
>>
>
>

Re: Dynamical Windows

Posted by vino yang <ya...@gmail.com>.
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 <an...@gmail.com>:

> 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
>