Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/mercurial/2.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 ApacheFlink-读取后将文件移动到其他文件夹_Apache Flink - Fatal编程技术网

Apache flink ApacheFlink-读取后将文件移动到其他文件夹

Apache flink ApacheFlink-读取后将文件移动到其他文件夹,apache-flink,Apache Flink,我正在从目录中读取csv文件并进行一些处理。 现在,flink只是选择该目录中的任何新文件并对其进行处理。这对我来说很好 我陷入了两个问题: 我想记录flink已完成处理的文件名 我想在flink完成处理后立即将处理过的文件移动到其他文件夹 我的代码片段是: final StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment(); org.apache.flink.core.fs.P

我正在从目录中读取csv文件并进行一些处理。 现在,flink只是选择该目录中的任何新文件并对其进行处理。这对我来说很好

我陷入了两个问题:

  • 我想记录flink已完成处理的文件名
  • 我想在flink完成处理后立即将处理过的文件移动到其他文件夹
  • 我的代码片段是:

    final StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
    
    org.apache.flink.core.fs.Path filePath = new org.apache.flink.core.fs.Path(feedFileFolderPath);
    
    RowCsvInputFormat format = new RowCsvInputFormat(filePath, FetchTypeInformation.getTypeInformation());
    
    DataStream<Row> inputStream = env.readFile(format, feedFileFolderPath, FileProcessingMode.PROCESS_CONTINUOUSLY,
                    parseInt(folderLookupTime));
    
    final StreamExecutionEnvironment env=StreamExecutionEnvironment.getExecutionEnvironment();
    org.apache.flink.core.fs.Path filePath=new org.apache.flink.core.fs.Path(feedFileFolderPath);
    RowCsvInputFormat=新的RowCsvInputFormat(filePath,FetchTypeInformation.getTypeInformation());
    DataStream inputStream=env.readFile(格式、feedFileFolderPath、FileProcessingMode.PROCESS),
    parseInt(folderLookupTime);
    
    这个话题在flink邮件列表中出现过好几次——请参见讨论和——但简短的总结是,在flink内部还没有一个简单的方法来实现这一点

    通常的做法似乎是使用cron作业定期将较旧的文件移出被监视的目录,并假定这些文件已被处理。如果您想更加小心,那么您必须实现自己的机制来跟踪处理作业的进度。上面提到的电子邮件线程包括一些如何做到这一点的想法