Hi,

       First sorry that I'm not expert on Window and please correct me if I'm 
wrong, but from my side, it seems the assigner might also be a problem in 
addition to the trigger: currently Flink window assigner should be all based on 
time (processing time or event time), and it might be hard to implement an 
event-driven window assigner that start to assign elements to a window after 
received some elements. 
      What comes to me is that a possible alternative method is to use the 
low-level KeyedProcessFunction directly:  you may register a timer 30 mins 
later when received the "search" event and write the time of search event into 
the state. Then for the following events, they will be saved to the state since 
the flag is set. After received the "start" event or the timer is triggered, 
you could load all the events from the states, do the aggregation and cancel 
the timer if it is triggered by "start" event. A simpler case is [1] and it 
does not consider stop the aggreation when received special event, but it seems 
that the logic could be added to the case.

[1] 
https://ci.apache.org/projects/flink/flink-docs-release-1.10/dev/stream/operators/process_function.html#example

Best,
 Yun




 ------------------Original Mail ------------------
Sender:aj <ajainje...@gmail.com>
Send Date:Sun May 24 01:10:55 2020
Recipients:Tzu-Li (Gordon) Tai <tzuli...@apache.org>
CC:user <user@flink.apache.org>
Subject:Re: Flink Window with multiple trigger condition


I am still not able to get much after reading the stuff. Please help with some 
basic code to start to build this window and trigger. 

Another option I am thinking is I just use a Richflatmap function and use the 
keyed state to build this logic. Is that the correct approach? 



On Fri, May 22, 2020 at 4:52 PM aj <ajainje...@gmail.com> wrote:


I was also thinking to have a processing time window but that will not work for 
me. I want to start the window when the user  "search" event arrives. So for 
each user window will start from the search event. 
 The Tumbling window has fixed start end time so that will not be suitable in 
my case. 




On Fri, May 22, 2020 at 10:23 AM Tzu-Li (Gordon) Tai <tzuli...@apache.org> 
wrote:
Hi,

To achieve what you have in mind, I think what you have to do is to use a
processing time window of 30 mins, and have a custom trigger that matches
the "start" event in the `onElement` method and return
TriggerResult.FIRE_AND_PURGE.

That way, the window fires either when the processing time has passed, or
the start event was recieved.

Cheers,
Gordon



--
Sent from: http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/


-- 
Thanks & Regards,
Anuj Jain
Mob. : +91- 8588817877 
Skype : anuj.jain07





-- 
Thanks & Regards,
Anuj Jain
Mob. : +91- 8588817877 
Skype : anuj.jain07



Reply via email to