apache—从flink中processwindowfunction的上下文获取收集器对象

sz81bmfz  于 2021-06-24  发布在  Flink
关注(0)|答案(0)|浏览(204)

我在processwindowfunction的clear步骤中模拟ttl缓存失效,并尝试在clear方法中访问process中使用的收集器对象。是否可以使用context或getruntimecontext获取它。

public class TimedProcess extends ProcessWindowFunction<Map<String, List<String>>, Map<String, List<String>>, String , TimeWindow> {

    Map<String, List<String>> cachedValue;

    @Override
    public void clear(Context context) throws Exception {
        // How to get output used in process function here

        // Collector<Map<String, List<String>>> output = ?

        // Map<String, List<String> recentCacheValue;
        // output.collect(recentCacheValue)

    }

    @Override
    public void process(String visitorId, Context context, Iterable<Map<String, List<String>>> input, Collector<Map<String, List<String>>> output) throws Exception {

         // cache store logic
         // output.collect(cachedValue);
    }

}

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题