You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@flink.apache.org by Sendoh <un...@gmail.com> on 2016/12/07 17:37:33 UTC

onEventTime() is not called after setting ctx.registerEventTimeTimer(timstamp)

Hi Flink users,

Can I ask is my understanding of onEventTime() correct?

In my custom trigger, I have sth as follows:

onElement(JSONObject element, long timestamp, W window, TriggerContext ctx){
    if(count == 3) {
       ctx.registerEventTimeTimer(ctx.getWatermark+100000);
       return TriggerResult.Continue;
  }
}

onEventTime(long time, W window, TriggerContext ctx){
      return TriggerResult.FIRE_AND_PURGE;
}

and I expect onEventTime(long time, W window, TriggerContext ctx) will be
called when watermark has passed 100000 millis.

but nothing happens,,,did I misunderstand sth? 

Best,

Hung Chang



--
View this message in context: http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/onEventTime-is-not-called-after-setting-ctx-registerEventTimeTimer-timstamp-tp10509.html
Sent from the Apache Flink User Mailing List archive. mailing list archive at Nabble.com.

Re: onEventTime() is not called after setting ctx.registerEventTimeTimer(timstamp)

Posted by Aljoscha Krettek <al...@apache.org>.
Hi,
onEventTime() will be called when the watermark passes <current
watermark> + 100_000, where <current watermark> is the watermark at the
time when you set the timer. Does the watermark advance that far?

Cheers,
Aljoscha

On Thu, 8 Dec 2016 at 01:51 Sendoh <un...@gmail.com> wrote:

> Hi Flink users,
>
> Can I ask is my understanding of onEventTime() correct?
>
> In my custom trigger, I have sth as follows:
>
> onElement(JSONObject element, long timestamp, W window, TriggerContext
> ctx){
>     if(count == 3) {
>        ctx.registerEventTimeTimer(ctx.getWatermark+100000);
>        return TriggerResult.Continue;
>   }
> }
>
> onEventTime(long time, W window, TriggerContext ctx){
>       return TriggerResult.FIRE_AND_PURGE;
> }
>
> and I expect onEventTime(long time, W window, TriggerContext ctx) will be
> called when watermark has passed 100000 millis.
>
> but nothing happens,,,did I misunderstand sth?
>
> Best,
>
> Hung Chang
>
>
>
> --
> View this message in context:
> http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/onEventTime-is-not-called-after-setting-ctx-registerEventTimeTimer-timstamp-tp10509.html
> Sent from the Apache Flink User Mailing List archive. mailing list archive
> at Nabble.com.
>