flink-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aljoscha Krettek <aljos...@apache.org>
Subject Re: Window
Date Sat, 07 May 2016 07:50:53 GMT
Hi,
you could do it with a combination of GlobalWindows and the
ContinuousProcessingTimeTrigger:

env.socketTextStream("192.168.1.101", 9999)
  .map(new mapper())
  .keyBy(0)
  .window(GlobalWindows.create())

.trigger(PurgingTrigger.of(ContinuousProcessingTimeTrigger.of(Time.seconds(5))))
  .apply(new MyRichWindowFunction())

This, however, will fire on 5 second intervals only for keys that have
already been seen once. So it might not be too useful. In general, it is
hard to do empty windows since windows are normally always tied to a key,
and if there is not element there is no key, and therefore normally no
window.

Cheers,
Aljoscha


On Thu, 5 May 2016 at 11:39 <toletum@toletum.org> wrote:

> Hi!
>
> I want a window which should be fired each 5 seconds, whether or not there
> events.
>
>         env.socketTextStream("192.168.1.101", 9999)
>         .map(new mapper())
>         .keyBy(0)
>         .timeWindow(Time.seconds(5))
>         .apply(new MyRichWindowFunction())
>
>
> It works if the window has events, but, it doesn't if there aren't events.
>
> Somebody knows how I could force it. I tried with a trigger and
> ContinuousProcessingTimeTrigger, but, I don't know how use it.
>
> Regards,
> Toletum
>
>

Mime
View raw message