flink-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephan Ewen <se...@apache.org>
Subject Re: Getting two types of events from a Window (Trigger)?
Date Thu, 10 Dec 2015 15:14:26 GMT
Hi Niels!

I think there is no clean way to emit data from a trigger right now, you
can only emit data from the window functions.

You can emit two different kind of data types using an "Either" type. This
is built-in in Scala, in Java we added it on 1.0-SNAPSHOT:
https://github.com/apache/flink/blob/master/flink-java/src/main/java/org/apache/flink/api/java/typeutils/Either.java

Maybe being able to emit different type of elements helps your use case...


These types of questions have been coming up quite a bit, people looking to
do different actions inside the windows on different triggers (on element,
on event time).

As per discussion with Aljoscha, one way to make this more flexible is to
enhance what you can do with custom state:
  - State has timeouts (for cleanup)
  - Functions allow you to schedule event-time progress notifications

Stephan



On Thu, Dec 10, 2015 at 11:55 AM, Niels Basjes <Niels@basjes.nl> wrote:

> Hi,
>
> I'm working on something that uses the Flink Window feature.
> I have written a custom Trigger to build the Window I need.
>
> I am using the Window feature because I need state and I need to expire
> (and clean) this state after a timeout (I use the onEventTime to do that).
> Because I need the data streaming in real time (augmented with the
> mentioned state) I 'FIRE' after every event. Just before I 'PURGE' the
> window I need the fact of this purge (and some of the stats of this Window)
> as a separate event in a separate 'DataStream'.
>
> Now the interfaces of the various classes only support output as a single
> java type (very sane choice).
> So what I do right now is put my events on something 'external'
> (HBase/Kafka) and read it in via a different Source implementation.
>
> My question: Is there a better way to do this?
> Can I (for example) create a special 'Source' that I can pass as a
> parameter to my Trigger and then onEventTime just output a 'new event' ?
>
> What do you recommend?
>
> --
> Best regards / Met vriendelijke groeten,
>
> Niels Basjes
>

Mime
View raw message