观看 NIFI 目录中的新文件

Watch new files in directory NIFI

我有一个用例,我每天在不同的时刻都有新文件,比如每隔一小时或两小时,所以我需要查看我的文件夹中的目录,并且在添加新文件时它会触发一个事件来发送这些文件NIFI 上我的网络服务的新文件路径,知道如何实现这个以及为此使用什么工具吗?

或者这不是最好的方法?

看看 ListFile 和 FetchFile 处理器:

https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-standard-nar/1.5.0/org.apache.nifi.processors.standard.ListFile/index.html

https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-standard-nar/1.5.0/org.apache.nifi.processors.standard.FetchFile/index.html

可以在 https://nifi.apache.org/docs.html

找到完整的 NiFi 文档

如果您的文件在文件系统中,则使用 'GETFILE' 处理器,该处理器在提供的 'input directory' 上添加新文件时会触发事件并立即将数据送入 NIFI,没有任何延迟。

如果您的要求是像每小时或任何特定时间一样安排它,那么使用每个处理器配置上的 'Scheduling' 选项卡并使用 'Cron-Driven' 策略安排它,并像这样为每小时设置 cron */60 * * * *?

如果您的文件在 S3 存储桶中,那么您必须使用 'GETSQS' 处理器使用 SQS 队列通知,详见下文 link

http://crazyslate.com/apache-nifi-intergration-with-aws-s3/

https://community.hortonworks.com/content/idea/76919/how-to-integrate-aws-sqs-queue-with-nifi.html