Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Apache 从Flink中ProcessWindowFunction的上下文获取收集器对象_Apache_Streaming_Apache Flink - Fatal编程技术网

Apache 从Flink中ProcessWindowFunction的上下文获取收集器对象

Apache 从Flink中ProcessWindowFunction的上下文获取收集器对象,apache,streaming,apache-flink,Apache,Streaming,Apache Flink,我在ProcessWindowFunction的clear步骤中模拟TTL缓存失效,并尝试以clear方法访问进程中使用的收集器对象。是否可以使用上下文或getRuntimeContext获取它 public class TimedProcess extends ProcessWindowFunction<Map<String, List<String>>, Map<String, List<String>>, String , TimeWi

我在ProcessWindowFunction的clear步骤中模拟TTL缓存失效,并尝试以clear方法访问进程中使用的收集器对象。是否可以使用上下文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);
    }

}
公共类TimedProcess扩展ProcessWindowFunction{
映射缓存值;
@凌驾
public void clear(上下文)引发异常{
//如何在这里获取过程函数中使用的输出
//收集器输出=?

//MapI我很确定这不会起作用。这看起来真的很奇怪。我们可以后退一步,检查一下您首先要实现的是什么吗?为什么它需要在
清除
?返回并重新检查了其他选项,发现对于那个用例,正确的实现方法是使用
处理函数
,这让我有了
定时器
控制触发器动作的方法。