flink-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Puneet Kinra <puneet.ki...@customercentria.com>
Subject Re: onTimer function is not getting executed and job is marked as finished.
Date Mon, 07 Jan 2019 13:15:30 GMT
Hi Hequn

Its a streaming job .

On Mon, Jan 7, 2019 at 5:51 PM Hequn Cheng <chenghequn@gmail.com> wrote:

> Hi Puneet,
>
> The value of the registered timer should within startTime and endTime of
> your job. For example, job starts at processing time t1 and stops at
> processing time t2. You have to make sure t1< `parseLong + 5000` < t2.
>
> Best, Hequn
>
> On Mon, Jan 7, 2019 at 5:50 PM Puneet Kinra <
> puneet.kinra@customercentria.com> wrote:
>
>> Hi All
>>
>> Facing some issue with context to onTimer method in processfunction
>>
>> class TimerTest extends ProcessFunction<Tuple2<String,String>,String>{
>>
>> /**
>> *
>> */
>> private static final long serialVersionUID = 1L;
>>
>> @Override
>> public void processElement(Tuple2<String, String> arg0,
>> ProcessFunction<Tuple2<String, String>, String>.Context ctx,
>> Collector<String> arg2) throws Exception {
>> // TODO Auto-generated method stub
>> long parseLong = Long.parseLong(arg0.f1);
>> TimerService timerService = ctx.timerService();
>> ctx.timerService().registerProcessingTimeTimer(parseLong + 5000);
>> }
>>
>> @Override
>> public void onTimer(long timestamp, ProcessFunction<Tuple2<String,
>> String>, String>.OnTimerContext ctx,
>> Collector<String> out) throws Exception {
>> // TODO Auto-generated method stub
>> super.onTimer(timestamp, ctx, out);
>> System.out.println("Executing timmer"+timestamp);
>> out.collect("Timer Testing..");
>> }
>> }
>>
>> --
>> *Cheers *
>>
>> *Puneet Kinra*
>>
>> *Mobile:+918800167808 | Skype : puneet.kinra@customercentria.com
>> <puneet.kinra@customercentria.com>*
>>
>> *e-mail :puneet.kinra@customercentria.com
>> <puneet.kinra@customercentria.com>*
>>
>>
>>

-- 
*Cheers *

*Puneet Kinra*

*Mobile:+918800167808 | Skype : puneet.kinra@customercentria.com
<puneet.kinra@customercentria.com>*

*e-mail :puneet.kinra@customercentria.com
<puneet.kinra@customercentria.com>*

Mime
View raw message