Hi Tim,

I think you could use Flink's trigger API [1] to implement a trigger which
fires when it sees a certain event or after some time.

[1]
https://ci.apache.org/projects/flink/flink-docs-stable/dev/stream/operators/windows.html#triggers

Cheers,
Till

On Wed, Apr 28, 2021 at 5:25 PM Tim Josefsson <tim.josefs...@webstep.se>
wrote:

> Hello!
>
> I'm trying to figure out how to implement a window that will emit events
> at regular intervals or when a specific event is encountered.
>
> A bit of background. I have a stream of events from devices that will send
> events to our system whenever a user watches a video. These events include
> a unique id (sessionId) shared by all events of the same same session so I
> want to key my stream on this. After that I want to aggregate all the
> events into a session summary and this summary I want to emit every 5
> minutes however I still want to keep the summary in the window (in case
> more events for that session arrives). However if I were to receive an end
> event (sent by the device once a user stops watching the video) I want to
> emit the summary and remove it from the window.
>
> Is it possible to do this with one of the existing windows together with a
> trigger or in some other way? Been trying to figure it out by reading the
> docs but haven't gotten any wiser so turning to the mailing list for help.
>
> Best regards,
> Tim
>

Reply via email to