如何为单个流文件指定优先级属性? [英] How to specify priority attributes for individual flowfiles?

查看:27
本文介绍了如何为单个流文件指定优先级属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在 NiFi 中使用 PrioritizeAttributePrioritizer.

I need to use PrioritizeAttributePrioritizer in NiFi.

我观察到以下参考中的优先级.https://nifi.apache.org/docs/nifi-docs/html/user-guide.html#settings

i have observed that prioritizers in below reference. https://nifi.apache.org/docs/nifi-docs/html/user-guide.html#settings

如果我收到 10 个流文件,那么我需要将每个流文件的优先级值设置为唯一.

if i receive 10 flowfiles then i need to set the priority value for every flow file to be unique.

之后指定队列配置必须是PrioritizeAttributePrioritizer.

After that specify queue configuration must be PrioritizeAttributePrioritizer.

然后根据优先级值处理流文件.

Then processing flowfiles based on priority value.

如何为单独的流文件设置优先级值或 Nifi 中的哪个优先级适合我的情况?

推荐答案

如果文件以生成时间命名(例如 file_2017-03-03T010101.csv),您是否考虑过使用 UpdateAttributes 将文件名解析为日期,将该日期放入 Epoch(恰好是递增的数字)作为第一级索引/优先级?

If the files are named after the time they have been generated (e.g. file_2017-03-03T010101.csv), have you considered using UpdateAttributes to parse the filename into a date, that date into Epoch (which happens to be an increasing number) as a first level index / prioritizer?

这样你就可以:

GetFile(单线程) -- 带FIFO的连接器 --> UpdateAttribute(添加从文件名日期开始的纪元) -- 连接器与 PriorityAttributePrioritizer --> 流程的其余部分

假设文件名为file_2017-03-03T010101.csv,则表达式语言将类似于:

Assuming the file name is file_2017-03-03T010101.csv, the expression language would be something like:

${filename:toDate("'file_'yyyy-MM-dd'T'HHmmss'.csv'", "UTC"):toNumber()}

这篇关于如何为单个流文件指定优先级属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆