Hi Team,
I am using tumbling window functionality having window size 5 minutes.
I want to perform setup & teardown functionality for each window. I tried
using RichWindowFunction but it didn't work for me.
Can anybody tell me how can I do it ?
Attaching code snippet what I tried
impressions.map(new
LineItemAdUnitAggr()).keyBy(0).timeWindow(Time.seconds(300)).apply(new
RichWindowFunction<Tuple2<Tuple2<Integer,Integer>,Long>, Boolean, Tuple,
TimeWindow>() {
@Override
public void open(Configuration parameters) throws Exception
{
super.open(parameters);
//setup method
}
public void apply(Tuple key, TimeWindow window,
Iterable<Tuple2<Tuple2<Integer, Integer>, Long>>
input,
Collector<Boolean> out) throws Exception {
//do processing
}
@Override
public void close() throws Exception {
//tear down method
super.close();
}
});
Thanks,
Swapnil