What are the alternatives to this code to prevent deprecation. I have even used assignTimeStamp Interface as well,but i am getting error with that
DataStream<Tuple2<Long, String>> sum = data.map(new MapFunction<String, Tuple2<Long, String>>()
{
public Tuple2<Long, String> map(String s)
{
String[] words = s.split(",");
return new Tuple2<Long, String>(Long.parseLong(words[0]), words[1]);
}
})
.assignTimestampsAndWatermarks(new AscendingTimestampExtractor<Tuple2<Long, String>>()
{
public long extractAscendingTimestamp(Tuple2<Long, String> t)
{
return t.f0;
}
})
.windowAll(TumblingEventTimeWindows.of(Time.seconds(5)))
.reduce(new ReduceFunction<Tuple2<Long, String>>()
{
public Tuple2<Long, String> reduce(Tuple2<Long, String> t1, Tuple2<Long, String> t2)
{
int num1 = Integer.parseInt(t1.f1);
int num2 = Integer.parseInt(t2.f1);
int sum = num1 + num2;
Timestamp t = new Timestamp(System.currentTimeMillis());
return new Tuple2<Long, String>(t.getTime(), "" + sum);
}
});